Skip to content

Commit

Permalink
Merge pull request #6 from karpolan/dev
Browse files Browse the repository at this point in the history
Release 0.1.5
  • Loading branch information
karpolan authored Apr 16, 2024
2 parents ea256b7 + c7760b6 commit 98c0bef
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 58 deletions.
30 changes: 23 additions & 7 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
# Minimum level of visible Logs
# Environment similar to NODE_ENV.
# Analytics and public resources are enabled only in "production"
# How to use: set value to "production" to get fully functional application.
NEXT_PUBLIC_ENV = development
# NEXT_PUBLIC_ENV = preview
# NEXT_PUBLIC_ENV = production

# Enables additional debug features, no additional debug information if the variable is not set
# How to use: set value to "true" to get more debugging information, but don't do it on production.
NEXT_PUBLIC_DEBUG = true

# Minimum level of visible Logs
NEXT_PUBLIC_LOG_LEVEL = DEBUG
# NEXT_PUBLIC_LOG_LEVEL = ERROR
# Public URL of the application/website.
# How to use: Do not set any value until you need custom domain for your application.
# NEXT_PUBLIC_PUBLIC_URL = https://xxx.com
# NEXT_PUBLIC_PUBLIC_URL = https://xxx.web.app
NEXT_PUBLIC_PUBLIC_URL = http://localhost:3000


# API/Backend basic URL
NEXT_PUBLIC_API_URL = http://localhost:3030
NEXT_PUBLIC_API_URL = http://localhost:5000
# NEXT_PUBLIC_API_URL = https://dev-api.domain.com
# NEXT_PUBLIC_API_URL = https://api.domain.com

# Other settings
NEXT_PUBLIC_GOOGLE_API_CLIENT_ID = _YOUR_CLIENT_ID_HERE_
# EmailJS configuration for contact form
NEXT_PUBLIC_EMAILJS_KEY = user-xxxx

# Analytics and Advertising
NEXT_PUBLIC_GA_ID = G-...
NEXT_PUBLIC_AMPLITUDE_API_KEY = 69abf7...
NEXT_PUBLIC_ADSENSE_CLIENT_ID = pub-12345...
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "next/core-web-vitals"
"extends": "next/core-web-vitals",
"rules": {
"import/no-cycle": "error"
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-mui-starter-ts",
"version": "0.1.3",
"version": "0.1.5",
"description": "_DESCRIPTION_",
"author": {
"name": "Anton Karpenko",
Expand Down
7 changes: 5 additions & 2 deletions src/components/AppIcon/AppIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { ComponentType, FunctionComponent, SVGAttributes } from 'react';
import { APP_ICON_SIZE } from '../config';
import { IconName, ICONS } from './config';

export interface AppIconProps extends SVGAttributes<SVGElement> {
/**
* Props of the AppIcon component, also can be used for SVG icons
*/
export interface Props extends SVGAttributes<SVGElement> {
color?: string;
icon?: IconName | string;
size?: string | number;
Expand All @@ -17,7 +20,7 @@ export interface AppIconProps extends SVGAttributes<SVGElement> {
* @param {string} [title] - title/hint to show when the cursor hovers the icon
* @param {string | number} [size] - size of the icon, default is ICON_SIZE
*/
const AppIcon: FunctionComponent<AppIconProps> = ({
const AppIcon: FunctionComponent<Props> = ({
color,
icon = 'default',
size = APP_ICON_SIZE,
Expand Down
4 changes: 2 additions & 2 deletions src/components/AppIcon/icons/LogoIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FunctionComponent } from 'react';
import { AppIconProps } from '../AppIcon';
import { IconProps } from '../utils';

const LogoIcon: FunctionComponent<AppIconProps> = (props) => {
const LogoIcon: FunctionComponent<IconProps> = (props) => {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 36 36" {...props}>
<path
Expand Down
11 changes: 11 additions & 0 deletions src/components/AppIcon/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { SVGAttributes } from 'react';

/**
* Props to use with custom SVG icons, similar to AppIcon's Props
*/
export interface IconProps extends SVGAttributes<SVGElement> {
color?: string;
icon?: string;
size?: string | number;
title?: string;
}
4 changes: 2 additions & 2 deletions src/components/AppIconButton/AppIconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Tooltip, IconButton, IconButtonProps, TooltipProps } from '@mui/materia
import AppIcon from '../AppIcon';
import AppLink from '../AppLink';
import { alpha } from '@mui/material';
import { AppIconProps } from '../AppIcon/AppIcon';
import { Props } from '../AppIcon/AppIcon';
import { IconName } from '../AppIcon/config';

export const MUI_ICON_BUTTON_COLORS = [
Expand All @@ -20,7 +20,7 @@ export const MUI_ICON_BUTTON_COLORS = [
export interface AppIconButtonProps extends Omit<IconButtonProps, 'color'> {
color?: string; // Not only 'inherit' | 'default' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning',
icon?: IconName | string;
iconProps?: Partial<AppIconProps>;
iconProps?: Partial<Props>;
// Missing props
component?: ElementType; // Could be RouterLink, AppLink, <a>, etc.
to?: string; // Link prop
Expand Down
4 changes: 2 additions & 2 deletions src/layout/BottomBar/BottomBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { ChangeEvent, FunctionComponent, useCallback } from 'react';
import { BottomNavigation, BottomNavigationAction } from '@mui/material';
import { usePathname, useRouter } from 'next/navigation';
import AppIcon from '../../components/AppIcon';
import { LinkToPage } from '../../utils/type';
import AppIcon from '@/components/AppIcon';
import { LinkToPage } from '@/utils/type';

interface Props {
items: Array<LinkToPage>;
Expand Down
8 changes: 4 additions & 4 deletions src/layout/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';
import { FunctionComponent, useCallback, MouseEvent } from 'react';
import { Stack, Divider, Drawer, DrawerProps, FormControlLabel, Switch, Tooltip } from '@mui/material';
import { AppIconButton } from '../../components';
import { useAppStore } from '../../store/AppStore';
import { LinkToPage } from '../../utils/type';
import { useEventLogout, useEventSwitchDarkMode, useOnMobile } from '../../hooks';
import { AppIconButton } from '@/components';
import { useAppStore } from '@/store/AppStore';
import { LinkToPage } from '@/utils/type';
import { useEventLogout, useEventSwitchDarkMode, useOnMobile } from '@/hooks';
import SideBarNavList from './SideBarNavList';
import { SIDEBAR_WIDTH, TOP_BAR_DESKTOP_HEIGHT } from '../config';

Expand Down
4 changes: 2 additions & 2 deletions src/layout/SideBar/SideBarNavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { FunctionComponent, MouseEventHandler } from 'react';
import { usePathname } from 'next/navigation';
import { ListItemButton, ListItemIcon, ListItemText } from '@mui/material';
import { AppIcon, AppLink } from '../../components';
import { LinkToPage } from '../../utils/type';
import { AppIcon, AppLink } from '@/components';
import { LinkToPage } from '@/utils/type';

interface Props extends LinkToPage {
openInNewTab?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/layout/SideBar/SideBarNavList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FunctionComponent, MouseEventHandler } from 'react';
import List from '@mui/material/List';
import SideBarNavItem from './SideBarNavItem';
import { LinkToPage } from '../../utils/type';
import { LinkToPage } from '@/utils/type';

interface Props {
items: Array<LinkToPage>;
Expand Down
2 changes: 1 addition & 1 deletion src/store/AppReducer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Reducer } from 'react';
import { localStorageSet } from '../utils/localStorage';
import { AppStoreState } from './AppStore';
import { AppStoreState } from './config';

/**
* Reducer for global AppStore using "Redux styled" actions
Expand Down
18 changes: 3 additions & 15 deletions src/store/AppStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,13 @@ import {
import AppReducer from './AppReducer';
import { localStorageGet } from '../utils/localStorage';
import { IS_SERVER } from '../utils/environment';

/**
* AppState data structure and initial values
*/
export interface AppStoreState {
darkMode: boolean;
isAuthenticated: boolean;
currentUser?: object | undefined;
}
const INITIAL_APP_STATE: AppStoreState = {
darkMode: false, // Overridden by useMediaQuery('(prefers-color-scheme: dark)') in AppStore
isAuthenticated: false, // Overridden in AppStore by checking auth token
};
import { APP_STORE_INITIAL_STATE, AppStoreState } from './config';

/**
* Instance of React Context for global AppStore
*/
export type AppContextReturningType = [AppStoreState, Dispatch<any>];
const AppContext = createContext<AppContextReturningType>([INITIAL_APP_STATE, () => null]);
const AppContext = createContext<AppContextReturningType>([APP_STORE_INITIAL_STATE, () => null]);

/**
* Main global Store as HOC with React Context API
Expand All @@ -48,7 +36,7 @@ const AppStoreProvider: FunctionComponent<PropsWithChildren> = ({ children }) =>
// const tokenExists = Boolean(loadToken());

const initialState: AppStoreState = {
...INITIAL_APP_STATE,
...APP_STORE_INITIAL_STATE,
darkMode: previousDarkMode || prefersDarkMode,
// isAuthenticated: tokenExists,
};
Expand Down
16 changes: 16 additions & 0 deletions src/store/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Data structure of the AppStore state
*/
export interface AppStoreState {
darkMode: boolean;
isAuthenticated: boolean;
currentUser?: object | undefined;
}

/**
* Initial values for the AppStore state
*/
export const APP_STORE_INITIAL_STATE: AppStoreState = {
darkMode: false, // Overridden by useMediaQuery('(prefers-color-scheme: dark)') in AppStore
isAuthenticated: false, // Overridden in AppStore by checking auth token
};
16 changes: 0 additions & 16 deletions styles/globals.css

This file was deleted.

0 comments on commit 98c0bef

Please sign in to comment.