Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix performance issue with SerializableStateInvariantMiddleware #162

Merged
merged 37 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
93ce8f1
[Client] Perf: SerializableStateInvariantMiddleware #159: 🐞 fix(Fix s…
ballyalley-o May 3, 2024
1bcb906
[Client] Back Button component #160: Added BackButton component and a…
ballyalley-o May 4, 2024
d6add5e
[Feature] Dashboard Layout : #123: Add AppLayout component and relate…
ballyalley-o May 4, 2024
a61300a
Refactor setSession function in utility.ts: Remove console.log statement
ballyalley-o May 5, 2024
8e93dd5
[Client] Back Button component #160: Add Button component and related…
ballyalley-o May 5, 2024
a7927be
[Feature] Dashboard Layout : #123: Refactor navbar component: Update …
ballyalley-o May 5, 2024
c0937d4
[Client] Back Button component #160: Add BackButton component and rel…
ballyalley-o May 5, 2024
bcfded2
[Config] Update layout configuration in layout.ts
ballyalley-o May 5, 2024
76a8850
Bootcamp: Details page #157: [Config] Update icon directory in icon-d…
ballyalley-o May 5, 2024
314ea1a
Add new routing constants in routing.ts
ballyalley-o May 5, 2024
4d7accd
Refactor typography and variant constants in typography.ts and varian…
ballyalley-o May 5, 2024
877d88c
Add new labels and placeholders in label.ts and placeholder.ts
ballyalley-o May 5, 2024
756b763
Refactor constant imports in index.ts
ballyalley-o May 5, 2024
804f38d
Add new ARIA constant for course table in aria.ts
ballyalley-o May 5, 2024
adb5aab
removed documentation param , due to conflict
ballyalley-o May 5, 2024
4937ad9
Bootcamp: Details page #157: BootcampView component
ballyalley-o May 5, 2024
a7d5c63
🐞 fix(Fixed pagination problemt):
ballyalley-o May 5, 2024
e2aa328
🐞 fix(Fix pagination problem in Course component):
ballyalley-o May 5, 2024
2b15c51
[Feature] Dashboard Layout : #123: Add AppNavBar and AppFooter compo…
ballyalley-o May 5, 2024
a0d2ba0
Bootcamp: Details page #157: Add BootcampViewPage component to Bootca…
ballyalley-o May 5, 2024
5a0e488
Bootcamp: Details page #157: Refactor BootcampViewSection and related…
ballyalley-o May 5, 2024
9af7230
[Client] TCCPISSUE: Refax Asset location utility (badgeLoc and photoL…
ballyalley-o May 5, 2024
aeeade7
Fix import statement in bootcamp-career.tsx
ballyalley-o May 5, 2024
6fc4e09
Bootcamp: Details page #157: Add BootcampViewSection component and re…
ballyalley-o May 5, 2024
5007d8a
Refactor CourseCard component in course-card.tsx
ballyalley-o May 5, 2024
07c264d
Refactor typography variant and font weight in dashboard-bootcamp-rd.tsx
ballyalley-o May 5, 2024
bdd6b8d
Clean-up: Refactor BootcampTile component in dashboard-bootcamp-tile.tsx
ballyalley-o May 5, 2024
265a040
Add 'section/bootcamp' export to 'src/section/index.ts'
ballyalley-o May 5, 2024
0319545
Bootcamp: Details page #157: Add getAllCourseByBootcamp query to cour…
ballyalley-o May 5, 2024
f815e04
Refactor main.ts: Add SSpanBox styled component and update SScrollBox…
ballyalley-o May 5, 2024
ca28b99
Refactor palette.ts: Update ACTION object with hover, selected, and d…
ballyalley-o May 5, 2024
ec4e6c6
Refactor theme.ts: Add GREY constant and update mode to use KEY.LIGHT
ballyalley-o May 5, 2024
fd33c0b
Update typography styles in src/theme/typography.ts
ballyalley-o May 5, 2024
e606301
Update Bootcamp interface properties in global.d.ts
ballyalley-o May 5, 2024
a1625a7
Add MUI typography variant overrides in mui.d.ts
ballyalley-o May 5, 2024
bb7ad4c
Refactor asset location functions in asset-loc.ts
ballyalley-o May 5, 2024
1792915
[Feature] Dashboard Layout : #123: Refactor app.tsx: Remove AppNavBar…
ballyalley-o May 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ function App() {
<BrowserRouter>
<SettingProvider>
<SnackProvider>
<AppNavBar />
<ErrorBoundary fallback={<Fallback fallbackTitle={FALLBACK.BAD_REQUEST.MESSAGE} errorCode={FALLBACK.BAD_REQUEST.CODE} />}>
<Router />
</ErrorBoundary>
<AppFooter />
</SnackProvider>
</SettingProvider>
</BrowserRouter>
Expand Down
1 change: 0 additions & 1 deletion src/auth/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export const setSession = (token: string | null) => {
localStorage.setItem(LOCAL_STORAGE.TOKEN, token)

axios.defaults.headers.common.Authorization = `${token}`
console.log(axios.defaults.headers.common.Authorization, 'axios.defaults.headers.common.Authorization')
const { exp } = jwtDecode(token)
tokenExpired(exp)
} else {
Expand Down
86 changes: 86 additions & 0 deletions src/component/button/back/back.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { useState, useEffect, useRef, Fragment, MouseEvent } from 'react'
import { m } from 'framer-motion'
import { useNavigate, useLocation } from 'react-router-dom'
import { ICON_NAME, useIcon } from 'hook'
import { useSettingContext } from 'component/setting'
import { Typography } from '@mui/material'
import { useTheme } from '@mui/material/styles'
import { KEY, LABEL, TYPOGRAPHY, VARIANT } from 'constant'
import { SPopover, SBackIconButton } from 'component/button'

const BackButton = () => {
const [open, setOpen] = useState(false)
const [anchorEl, setAnchorEl] = useState<EventTarget | null>(null)

const { themeMode } = useSettingContext()
const { pathname } = useLocation()
const navigate = useNavigate()
const navRef = useRef(null)
const theme = useTheme()

const { Icon, iconSrc: backIconSrc } = useIcon(ICON_NAME.BACK)

const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget)
navigate(-1)
}

useEffect(() => {
if (open) {
handleClose()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname])

useEffect(() => {
const appBarEl = Array.from(document.querySelectorAll('.MuiAppBar-root')) as HTMLElement[]

const styles = () => {
document.body.style.overflow = ''
document.body.style.padding = ''

appBarEl.forEach((elem) => {
elem.style.padding = ''
})
}

if (open) {
styles()
} else {
styles()
}
}, [open])

const handleOpen = (event: MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget)
setOpen(true)
}

const handleClose = () => {
setOpen(false)
}

return (
<Fragment>
<SBackIconButton onClick={handleClick} aria-label={LABEL.GO_BACK} onMouseEnter={handleOpen} onMouseLeave={handleClose}>
<Icon icon={backIconSrc} width={50} />
</SBackIconButton>
<SPopover
open={open}
anchorEl={anchorEl as Element}
anchorOrigin={{ vertical: KEY.CENTER, horizontal: KEY.RIGHT }}
transformOrigin={{ vertical: KEY.CENTER, horizontal: KEY.LEFT }}
sx={{
marginLeft: 3
}}>
<m.div>
<Typography variant={TYPOGRAPHY.BODY1} color={themeMode === KEY.LIGHT ? theme.palette.grey[700] : theme.palette.grey[400]}>
{LABEL.GO_BACK}
</Typography>
</m.div>
</SPopover>
</Fragment>
)
}

export default BackButton
1 change: 1 addition & 0 deletions src/component/button/back/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as BackButton } from './back'
2 changes: 2 additions & 0 deletions src/component/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { default as Button } from './button'
export { default as BackButton } from './back/back'
export { default as AnimatedButton } from './button-animated'
export * from './style'
29 changes: 29 additions & 0 deletions src/component/button/style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { styled } from '@mui/material/styles'
import { Popover, IconButton } from '@mui/material'

export const SPopover = styled(Popover)(({ theme }) => ({
'& .MuiPaper-root': {
backgroundColor: 'transparent',
boxShadow: 'none',
size: '100%',
overflow: 'hidden',
borderRadius: 0
},
'& .MuiPopover-paper': {
overflow: 'hidden'
},
'& .MuiPopover-paper .MuiList-root': {
padding: '0px'
},
'& .MuiPopover-paper .MuiTypography-root': {
fontSize: '1rem'
},
boxShadow: 'none',
pointerEvents: 'none'
}))

export const SBackIconButton = styled(IconButton)(({ theme }) => ({
borderRadius: 2,
padding: 1,
marginBottom: 2
}))
1 change: 1 addition & 0 deletions src/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { default as Paper } from './paper/paper'
export { default as Snackbar } from './snackbar/snackbar'
// button
export { default as Button } from './button/button'
export { default as BackButton } from './button/back/back'
// typography
export { default as Typography } from './typography/typography'
// markdown
Expand Down
3 changes: 2 additions & 1 deletion src/component/navbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { default as Navbar } from './navbar'
export { default as AppNavBar } from './appbar'
export { default as AppBar } from './appbar'
export { default as AppNavBar } from './app-appbar'
export { default as AppFooter } from './footer'
export { default as NavDrawer } from './nav-drawer'
export { default as AccountPopover } from './account-popover'
4 changes: 2 additions & 2 deletions src/component/navbar/nav-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NavDrawer = ({ open, onClose }: NavDrawerProps) => {
sx={{ pl: 0.5 }}
/>
<SListItem>
<Link to='/find-bootcamp-by-course' style={{ textDecoration: 'none', color: 'inherit' }}>
<Link to='/bootcamp/all' style={{ textDecoration: 'none', color: 'inherit' }}>
<ListItemText primary={<Typography variant='subtitle2'>Find a Bootcamp</Typography>} />
</Link>
</SListItem>
Expand Down Expand Up @@ -53,7 +53,7 @@ const NavDrawer = ({ open, onClose }: NavDrawerProps) => {
</Link>
</SListItem>
<SListItem>
<Link to='/course' style={{ textDecoration: 'none', color: 'inherit' }}>
<Link to='/course/all' style={{ textDecoration: 'none', color: 'inherit' }}>
<ListItemText primary={<Typography variant='subtitle2'>Find a Course</Typography>} />
</Link>
</SListItem>
Expand Down
15 changes: 14 additions & 1 deletion src/config/icon-directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,28 @@ function _getWebIcon(icon: string) {
const ICON_WEB = {
ALERT_OUTLINE: _getWebIcon('alert-triangle-outline'),
ARROW_FORWARD: _getWebIcon('arrow-ios-forward'),
BACK: _getWebIcon('arrow-ios-back-outline'),
CHEVRON_RIGHT: _getWebIcon('chevron-right-outline'),
CHEVRON_DOWN: _getWebIcon('chevron-down-outline'),
CLOSE: _getWebIcon('close-fill'),
CHECKMARK_CIRCLE: _getWebIcon('checkmark-circle-outline'),
CHECK_OUTLINE: _getWebIcon('checkmark-outline'),
CLOSE_OUTLINE: _getWebIcon('close-outline'),
CONTRAST_BOX: _getWebIcon('contrast-box'),
EDIT: _getWebIcon('edit-2-outline'),
ERROR_OUTLINE: _getWebIcon('alert-circle-outline'),
ERROR: _getWebIcon('alert-circle'),
PLUS: _getWebIcon('plus-outline'),
RETRACT: _getWebIcon('minus-outline'),
INFO: _getWebIcon('info'),

EYE_OFF: _getWebIcon('eye-off-outline'),
EYE_HIDE: _getWebIcon('eye-outline'),

FULLSCREEN: _getWebIcon('fullscreen'),
FULLSCREEN_EXIT: _getWebIcon('fullscreen-exit'),
GLOBE: _getWebIcon('globe-2-outline'),
PHONE: _getWebIcon('phone-outline'),
REFRESH: _getWebIcon('refresh'),

MODE_LIGHT: _getWebIcon('sun'),
Expand Down Expand Up @@ -69,7 +76,10 @@ export enum ICON_WEB_NAME {
// @web
ALERT_OUTLINE = 'ALERT_OUTLINE',
ARROW_FORWARD = 'ARROW_FORWARD',
BACK = 'BACK',
CHECKMARK_CIRCLE = 'CHECKMARK_CIRCLE',
CHECK_OUTLINE = 'CHECK_OUTLINE',
CLOSE_OUTLINE = 'CLOSE_OUTLINE',
CHEVRON_RIGHT = 'CHEVRON_RIGHT',
CHEVRON_DOWN = 'CHEVRON_DOWN',
CLOSE = 'CLOSE',
Expand All @@ -80,12 +90,15 @@ export enum ICON_WEB_NAME {
EYE_OFF = 'EYE_OFF',
EYE_HIDE = 'EYE_HIDE',
INFO = 'INFO',

PHONE = 'PHONE',
GLOBE = 'GLOBE',
MODE_LIGHT = 'MODE_LIGHT',
MODE_DARK = 'MODE_DARK',

FULLSCREEN = 'FULLSCREEN',
FULLSCREEN_EXIT = 'FULLSCREEN_EXIT',
PLUS = 'PLUS',
RETRACT = 'RETRACT',
REFRESH = 'REFRESH',

SAVE = 'SAVE',
Expand Down
28 changes: 28 additions & 0 deletions src/config/layout.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
/**
* Layout configuration for the application
*
* Dimensions are in pixels
*
*/
export const HEADER = {
H_MOBILE: 64,
H_MAIN_DESKTOP: 88,
H_DASHBOARD_DESKTOP: 65,
H_DASHBOARD_DESKTOP_OFFSET: 92 - 32
}

export const FOOTER = {
H: 64
}

export const SPACING = {
XS: 4,
SM: 8,
MD: 16,
LG: 24,
XL: 32,
XXL: 40,
XXXL: 48,
DESKTOP: 80
}

export const NAV = {
W_BASE: 260,
W_DASHBOARD: 300,
Expand Down
3 changes: 2 additions & 1 deletion src/constant/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ enum ARIA {
LAST_NAME = 'Last name',
TOGGLE_PASSWORD = 'toggle password visibility',
TABS = 'tabs',
COMPANY_BADGE = 'company badge'
COMPANY_BADGE = 'company badge',
COURSE_TABLE = 'course table'
}

export default ARIA
1 change: 0 additions & 1 deletion src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export { default as MENU_POPOVER_ARROW } from './menu-popover-arrow'
export { default as TITLE } from './title'
export { default as ARIA } from './aria'
export { BUTTON } from './button'
export * from './typography'
export * from './size'
export * from './color'
export * from './component'
Expand Down
18 changes: 15 additions & 3 deletions src/constant/label.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { KEY } from 'constant'

const LABEL = {
GO_BACK: 'Go Back',
LOG_IN: 'Log In',
LOG_OUT: 'Log Out',
DISPLAY_SETTINGS: 'Display Settings',
Expand All @@ -12,20 +13,31 @@ const LABEL = {
},
REGISTER: 'Register',
RESET_PASSWORD: 'Reset Password',
COURSE_COVERED: 'Course certifications covered',
HOME: 'Home',

LOCATION: 'Location',
CAREER: 'Careers',
CONTACT: 'Contact',
ALREADY_MEMBER: `Already a member? `,
NOT_A_MEMBER: `Not a member yet? `,
LOGIN_Sub: 'Log in here ',
REGISTER_Sub: 'Register for free',
FORGOT_PASSWORD: 'Forgot password?',

RATING: 'Rating',
SELECT_ROLE: 'Select your role',

WEBSITE: 'Website',
VISIT_WEBSITE: 'Visit Website',
ADMIN: 'Admin',
STUDENT: 'Student',
TRAINER: 'Trainer',

TITLE: 'Title',
DESCRIPTION: 'Description',
DURATION: 'Duration',
COST: 'Cost',
SKILL_REQUIRED: 'Skill Required',
SCHOLARSHIP: 'Scholarship',

BOOTCAMP_PAGE_TITLE: 'Worldclass Bootcamps Worldwide',
COURSE_PAGE_TITLE: 'World Class Courses',

Expand Down
3 changes: 3 additions & 0 deletions src/constant/placeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ enum PLACEHOLDER {
NO_DURATION = 'No duration specified',
NO_TUITION = 'No tuition specified',
NO_MINIMUM_SKILL = 'No minimum skill required',
NO_COURSE_AVAILABLE = 'No course available',
NO_LOCATION = 'No location provided',
NO_CAREER = 'No career provided',

// @bootcamp search form
MILES_FROM = 'Miles From',
Expand Down
2 changes: 2 additions & 0 deletions src/constant/routing/routing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
enum ROUTING {
ROOT = '/',
ALL = 'all',
ID = ':id',
VIEW = 'view',
DASHBOARD = 'dashboard',
// :bootcamp
BOOTCAMP = 'bootcamp',
Expand Down
27 changes: 0 additions & 27 deletions src/constant/typography.ts

This file was deleted.

Loading
Loading