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

Feedback Slice, Feedback Quote bubble component, and Perf related #179

Merged
merged 26 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2964d74
feat: add APPLY_FOR_COURSE label to constant/label.ts
ballyalley-o May 7, 2024
9b5e5ec
refactor: Add collapse table component to CourseRow for better code o…
ballyalley-o May 7, 2024
a67ed84
refactor: Add CollapseGrid component to Bootcamp section for better c…
ballyalley-o May 7, 2024
110d24d
🐞 fix(refactor: Adjust position of GSBadgeImg in main.ts):
ballyalley-o May 7, 2024
6e09074
refactor: Update background styling in AppForm component
ballyalley-o May 7, 2024
1a71bef
refactor: Remove commented out code in main.tsx
ballyalley-o May 7, 2024
e9b3285
[BUG] Failed Auth in Login page throws an exemption #167
ballyalley-o May 7, 2024
e40ba2f
[BUG] Failed Auth in Login page throws an exemption #167: refactor: H…
ballyalley-o May 7, 2024
9b9ff01
[Client] TCCPISSUE: Refactor Navbar Drawer #141: [Clean-up] refactor:…
ballyalley-o May 11, 2024
8d1b134
Redux | Feedback Slice #17: Add FEEDBACK route to routing constants
ballyalley-o May 11, 2024
6d9f048
Add FEEDBACKS and TAGS labels to constant/label.ts
ballyalley-o May 11, 2024
4d3771a
update placeholder.ts
ballyalley-o May 11, 2024
23f6901
refactor: Adjust padding in main.tsx
ballyalley-o May 11, 2024
986b66f
Optimized Bootcamp page with lazy loading for images
ballyalley-o May 11, 2024
9b2d1d1
feat: Add BOOTCAMP_FEEDBACK route to ServerPath class
ballyalley-o May 11, 2024
070691e
[Client] Feat: Feedback Quote buble #171: Add FeedbackBubble compone…
ballyalley-o May 11, 2024
119ad12
[Client] Feat: Feedback Quote buble #171: Add FeedbackBubble compone…
ballyalley-o May 11, 2024
f47ceb6
chore: Remove unused Bootcamp component and export statement
ballyalley-o May 11, 2024
2197a5a
feat: Add QuoteBubble component for displaying feedback quotes
ballyalley-o May 11, 2024
f391ed6
Slices-reducer: Bootcamp - Feedback
ballyalley-o May 11, 2024
06d2a84
Redux | Feedback Slice #17: Add feedback endpoint and slice for API i…
ballyalley-o May 11, 2024
87eee18
🎈 perf(Redux | Feedback Slice #17: Add feedbackReducer to root-reduce…
ballyalley-o May 11, 2024
94aeda0
chore: Update main.ts to include flex display and transparent backgro…
ballyalley-o May 11, 2024
6fada9b
refactor: Update palette.ts to fix primary and background colors
ballyalley-o May 11, 2024
4463a33
🐳 chore(chore: Update npm dependencies):
ballyalley-o May 11, 2024
1dd5ba3
Merge pull request #178 from ballyalley-o/feat/TCCP17-redux--feedback…
ballyalley-o May 11, 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
1,394 changes: 1,380 additions & 14 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"@types/nprogress": "^0.2.3",
"@types/react-avatar-editor": "^13.0.2",
"axios": "^1.6.8",
"colors": "^1.4.0",
"framer-motion": "^11.0.8",
"good-logs": "^1.2.3",
"gsap": "^3.12.5",
"markdown-to-jsx": "^7.4.1",
"notistack": "^3.0.1",
Expand Down
5 changes: 3 additions & 2 deletions src/component/form/app-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ export default function AppForm({ isLogin, size = 'sm', children, ...props }: Ap
<Box
sx={{
display: 'flex',
backgroundImage: `url(${ASSET.PATTERN_BG})`,
// backgroundImage: `url(${ASSET.PATTERN_BG})`,
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
backgroundColor: 'common.black',
margin: 'auto',
fontSize: '1.2rem',
color: 'common.white'
}}>
<Container maxWidth={size} sx={{ width: isLogin ? 500 : 'auto' }}>
<Box sx={{ height: '100vh', alignContent: 'center' }}>
<Paper
background="dark"
background='dark'
sx={{
py: { xs: 4, md: 8 },
px: { xs: 3, md: 6 },
Expand Down
36 changes: 10 additions & 26 deletions src/component/navbar/app-appbar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { useEffect, useState } from 'react'
import { Link as RouterLink, useParams, useLocation } from 'react-router-dom'
import { useState } from 'react'
import { useLocation } from 'react-router-dom'
import { useSelector } from 'react-redux'
import { createSelector } from 'reselect'
import { m } from 'framer-motion'
import { Box, Link, IconButton, Stack } from '@mui/material'
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
import ExpandLessIcon from '@mui/icons-material/ExpandLess'
import { Button } from 'component'
import AppBar from './appbar'
import { MotionLazyContainer, MotionText, varFade } from 'component/motion'
import { SToolbar, SBox } from 'theme/style'
Expand All @@ -15,8 +13,9 @@ import { NavDrawer } from 'component/navbar'
import { Logo } from 'component/logo'
import { AccountPopover } from 'component/navbar'
import { GLOBAL } from 'config'
import { BUTTON } from 'constant'
import { BUTTON, BUTTON_VARIANT, FLEX, TYPOGRAPHY, VARIANT } from 'constant'
import { RootPath, AuthPath } from 'route/path'
import { SRegisterButton } from './style'

const rightLink = {
fontSize: 12,
Expand Down Expand Up @@ -51,7 +50,7 @@ function AppNavBar(): JSX.Element {
<Logo width={40} onMouseEnter={() => setIsLogoHovered(true)} onMouseLeave={() => setIsLogoHovered(false)} />

<Link
variant='body1'
variant={TYPOGRAPHY.BODY1}
underline='none'
href={RootPath.DASHBOARD}
sx={{
Expand Down Expand Up @@ -112,33 +111,18 @@ function AppNavBar(): JSX.Element {
sx={{
py: 1,
flex: 1,
display: 'flex',
justifyContent: 'flex-end'
display: FLEX.FLEX,
justifyContent: FLEX.FLEX_END
}}></Box>
) : (
<AnimatedButton to={AuthPath.LOG_IN} text={BUTTON.LOG_IN} style={rightLink} />
)}
<Box>
{!user && !isRegisterRoute && (
<Link variant='h6' underline='none' href={AuthPath.REGISTER} sx={{ ...rightLink, color: 'secondary.main' }}>
<Button
variant='contained'
color='primary'
sx={{
fontSize: 12,
fontWeight: 'bold',
padding: '.1em 1em',
borderRadius: 0,
textTransform: 'none',
border: '1px solid transparent',
'&:hover': {
bgcolor: 'secondary.main',
color: 'common.black',
border: '1px solid'
}
}}>
<Link variant={TYPOGRAPHY.H6} underline='none' href={AuthPath.REGISTER} sx={{ ...rightLink, color: 'secondary.main' }}>
<SRegisterButton variant={BUTTON_VARIANT.CONTAINED} color='primary'>
{BUTTON.REGISTER}
</Button>
</SRegisterButton>
</Link>
)}
</Box>
Expand Down
16 changes: 16 additions & 0 deletions src/component/navbar/style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { styled } from '@mui/material/styles'
import { Button } from '@mui/material'

export const SRegisterButton = styled(Button)(({ theme }) => ({
fontSize: 12,
fontWeight: 'bold',
padding: '.1em 1em',
borderRadius: 0,
textTransform: 'none',
border: '1px solid transparent',
'&:hover': {
bgcolor: theme.palette.secondary.main,
color: theme.palette.common.black,
border: '1px solid'
}
}))
3 changes: 3 additions & 0 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 = {
APPLY_FOR_COURSE: 'Apply for this Course',
GO_BACK: 'Go Back',
LOG_IN: 'Log In',
LOG_OUT: 'Log Out',
Expand All @@ -14,9 +15,11 @@ const LABEL = {
REGISTER: 'Register',
RESET_PASSWORD: 'Reset Password',
COURSE_COVERED: 'Course certifications covered',
FEEDBACKS: 'Feedbacks',
HOME: 'Home',
LOCATION: 'Location',
CAREER: 'Careers',
TAGS: ' Tags: ',
CONTACT: 'Contact',
ALREADY_MEMBER: `Already a member? `,
NOT_A_MEMBER: `Not a member yet? `,
Expand Down
1 change: 1 addition & 0 deletions src/constant/placeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum PLACEHOLDER {
NO_MINIMUM_SKILL = 'No minimum skill required',
NO_COURSE_AVAILABLE = 'No course available',
NO_LOCATION = 'No location provided',
NO_FEEDBACK = 'No feedbacks for this bootcamp',
NO_CAREER = 'No career provided',

// @bootcamp search form
Expand Down
1 change: 1 addition & 0 deletions src/constant/routing/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum ROUTING {
REGISTER = 'register',
ACCOUNT = 'account',
USER = 'user',
FEEDBACK = 'feedback',
FORGOT_PASSWORD = 'forgot-password',
RESET_PASSWORD = 'reset-password',
RESET_TOKEN = 'reset-token',
Expand Down
2 changes: 1 addition & 1 deletion src/page/app/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Main: FC<MainProps> = ({ children, isDesktop }) => {
pt: `${HEADER.H_MOBILE + SPACING.SM}px`,
pb: `${HEADER.H_MOBILE + SPACING.SM}px`,
...(isDesktop && {
px: 2,
// px: 2,
pb: `${HEADER.H_DASHBOARD_DESKTOP + SPACING.SM}px`
})
}}>
Expand Down
5 changes: 2 additions & 3 deletions src/page/auth/log-in/log-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ function LogIn() {
throw new Error(RESPONSE.error.INVALID_CREDENTIAL)
}
} catch (error: any) {
console.error('error : ', error || '')
snack(error?.data?.message, { variant: COLOR.ERROR })
reset()
if (error.message === RESPONSE.error.INVALID_CREDENTIAL) {
if (error?.data?.message === RESPONSE.error.INVALID_CREDENTIAL) {
setError(KEY.EMAIL, { message: RESPONSE.error.EMAIL_INVALID })
setError(KEY.PASSWORD, { message: RESPONSE.error.PASSWORD_INVALID })
} else {
snack(error.message, {
snack(error?.data?.message, {
variant: COLOR.ERROR
})
setError(KEY.EMAIL, { message: error.message })
Expand Down
22 changes: 10 additions & 12 deletions src/page/bootcamp/bootcamp.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { useState } from 'react'
import { memo } from 'react'
import { useSelector } from 'react-redux'
import { dispatch } from 'store'
import { m } from 'framer-motion'
import { Pagination, Box, Grid } from '@mui/material'
import { SCard } from 'theme/style'
import { useGetAllBootcampQuery } from 'store/slice/bootcamp'
import { setCurrentPage } from 'store/slice/bootcamp/bootcamp'
import { BootcampSearch, BootcampCard } from 'section/bootcamp'
import { MotionLazyContainer } from 'component/motion'
import { SkeletonLoader } from 'component/skeleton'
import { Typography } from 'component/typography'
import { ASSET } from 'config'
import { FLEX, KEY, LABEL, PLACEHOLDER } from 'constant'
import { FLEX, KEY, LABEL, TYPOGRAPHY } from 'constant'

function Bootcamp() {
const [currentPage, setCurrentPage] = useState(1)
const { currentPage } = useSelector((state: any) => state.bootcamp)
const { data, error, isLoading } = useGetAllBootcampQuery()

const handlePageChange = (event: any, value: any) => {
setCurrentPage(value)
dispatch(setCurrentPage(value))
}

return (
Expand All @@ -37,7 +40,7 @@ function Bootcamp() {
}}>
<img src={ASSET.TCCP_ICON} alt='logo' width={100} />
</Box>
<Typography variant='h2' marked='center' align='center' component='h2'>
<Typography variant={TYPOGRAPHY.H2} marked='center' align='center' component='h2'>
{LABEL.BOOTCAMP_PAGE_TITLE}
</Typography>
</Box>
Expand All @@ -56,12 +59,7 @@ function Bootcamp() {
color='primary'
sx={{ display: 'flex', justifyContent: 'flex-end', mb: 2 }}
/>
<SCard
sx={{
width: '100%',
display: 'flex',
bgcolor: 'transparent'
}}>
<SCard sx={{}}>
<Grid container flexDirection='column' flex={1} sx={{ backgroundColor: 'transparent' }}>
{isLoading ? (
<SkeletonLoader cards={8} />
Expand All @@ -88,4 +86,4 @@ function Bootcamp() {
)
}

export default Bootcamp
export default memo(Bootcamp)
3 changes: 3 additions & 0 deletions src/route/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class ServerPath {
static SERVER = GLOBAL.APP_SERVER
static BOOTCAMP = ROUTING.BOOTCAMP
static BOOTCAMP_ID = (bootcampId: string) => conNex(ROUTING.BOOTCAMP, bootcampId)
static BOOTCAMP_FEEDBACK = (bootcampId: string) => conNex(ROUTING.BOOTCAMP, bootcampId, ROUTING.FEEDBACK)
static COURSE = ROUTING.COURSE
static COURSE_ID = (courseId: string) => conNex(ROUTING.COURSE, courseId)
static COURSE_BY_BOOTCAMP = (bootcampId: string) => conNex(ROUTING.BOOTCAMP, bootcampId, ROUTING.COURSE)
Expand All @@ -21,6 +22,8 @@ export class ServerPath {
static AUTH_USER = conNex(ROUTING.AUTH, ROUTING.USER)
static AUTH_SINGLE_USER = (userId: string) => conNex(ROUTING.AUTH, ROUTING.USER, userId)
static AUTH_ACCOUNT = conNex(ROUTING.AUTH, ROUTING.ACCOUNT)
static FEEDBACK = ROUTING.FEEDBACK
static FEEDBACK_ID = (feedbackId: string) => conNex(ROUTING.FEEDBACK, feedbackId)
}

export class RootPath {
Expand Down
103 changes: 0 additions & 103 deletions src/section/bootcamp/bootcamp.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/section/bootcamp/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { default as Bootcamp } from './bootcamp'
export { default as BootcampSearch } from './bootcamp-search'
export { default as BootcampCard } from './bootcamp-card'
export { default as BootcampCareer } from './bootcamp-career'
Expand Down
Loading
Loading