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

Refactor3 #83

Merged
merged 190 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
2c185ab
feat: install axios
Summer-luna Jul 6, 2023
a3bab04
feat: install @nestjs/config
Summer-luna Jul 9, 2023
618327f
feat: imports HttpModule and ConfigModule
Summer-luna Jul 9, 2023
c73f451
feat: clickup custom field return type
Summer-luna Jul 9, 2023
0f7ee7d
feat: get ClickUp Custom Fields
Summer-luna Jul 9, 2023
d98556a
feat: click custom field form
Summer-luna Jul 9, 2023
f9a265a
fix: remove unused imports
Summer-luna Jul 9, 2023
34b0a5a
fix: render Custom Field
Summer-luna Jul 9, 2023
c2ab9d4
styles: form style
Summer-luna Jul 10, 2023
3811eff
fix: accept single react node
Summer-luna Jul 10, 2023
3c021bb
feat: add more export to clickup form fields
Summer-luna Jul 10, 2023
3e3e86f
feat: (server) get clickup list statuses
Summer-luna Jul 10, 2023
70dd098
feat: (client) improve invoice export form
Summer-luna Jul 10, 2023
e934f9e
fix: remove used imports
Summer-luna Jul 10, 2023
8b946ad
fix: loading button changing will cause table variant
Summer-luna Jul 10, 2023
688fc5b
fix: remove dates and IRS, Invoice Payment Status from custom fields
Summer-luna Jul 11, 2023
11cd099
feat: pass data through react router state
Summer-luna Jul 11, 2023
6b7b35f
feat: (server) create Task
Summer-luna Jul 11, 2023
827603a
feat: (client) create Task via export form
Summer-luna Jul 11, 2023
3d0d2e6
fix: remove unused imports
Summer-luna Jul 11, 2023
a35320f
feat install graphql-type-json package
Summer-luna Jul 11, 2023
3418abf
feat: able to add new task to clickup
Summer-luna Jul 11, 2023
beec86d
feat: click up task schema
Summer-luna Jul 12, 2023
d64035b
feat: create new click up task service, resolver, model, and dto
Summer-luna Jul 12, 2023
ca3a600
feat: click up graphql query and mutation
Summer-luna Jul 12, 2023
36ee8d2
fix: remove link from comments
Summer-luna Jul 12, 2023
107fdfd
feat: create new task to clickup and local db and connect to particul…
Summer-luna Jul 12, 2023
29d51ec
feat: add deletable field to comment table schema
Summer-luna Jul 12, 2023
1575cb0
feat: hide delete button when comment is not deletable
Summer-luna Jul 12, 2023
0477948
feat: able to update click up task and its custom fields
Summer-luna Jul 12, 2023
7e74553
feat: (client) update click up task and its custom fields
Summer-luna Jul 12, 2023
602e3b6
fix: remove used imports
Summer-luna Jul 12, 2023
3132989
fix: remove used variable
Summer-luna Jul 12, 2023
bba1d22
feat: navigate to invoice detail page after export
Summer-luna Jul 12, 2023
520d620
fix: reset content
Summer-luna Jul 12, 2023
70b5b2a
fix: switch button text
Summer-luna Jul 12, 2023
5e228af
feat: add a click up task icon with clickup url
Summer-luna Jul 12, 2023
788012e
fix: icon position
Summer-luna Jul 12, 2023
b6534c1
fix: style active nav bar item
Summer-luna Jul 12, 2023
ae1652b
fix: remove employee rate from edit and add form
Summer-luna Jul 12, 2023
daa4a04
fix: change button text from cancel to close
Summer-luna Jul 12, 2023
a5bc0bd
fix: remove unused imports
Summer-luna Jul 12, 2023
c936f6b
fix: display all employees and projects whose work hours is not equals 0
Summer-luna Jul 12, 2023
b631b52
fix: report page searching
Summer-luna Jul 13, 2023
3e906f1
fix: edit title
Summer-luna Jul 13, 2023
5fa777a
Merge remote-tracking branch 'origin/ImprovingAndFix' into ImprovingA…
Summer-luna Jul 13, 2023
35f523e
feat: new export to clickup icon
Summer-luna Jul 13, 2023
81d3282
feat: modified display card
Summer-luna Jul 13, 2023
a0b739f
fix: remove employee rate
Summer-luna Jul 13, 2023
e045736
fix: remove employee rate from form
Summer-luna Jul 13, 2023
ab2aeca
refactor: using reusable table
Summer-luna Jul 13, 2023
5e64831
refactor: set header to uppercase
Summer-luna Jul 13, 2023
99e22e7
feat: add backdrop when updating the click up task
Summer-luna Jul 14, 2023
bbdbbb9
fix: attribute name
Summer-luna Jul 14, 2023
07b9366
feat: able to update invoice
Summer-luna Jul 14, 2023
ec719f5
refactor: ignore same input
Summer-luna Jul 14, 2023
1c82e21
refactor: show no data text
Summer-luna Jul 14, 2023
550a973
feat: return employee status
Summer-luna Jul 17, 2023
4055aff
feat: slack icon
Summer-luna Jul 17, 2023
f627c8d
feat: change graphql query
Summer-luna Jul 17, 2023
5a86b76
fix: remove async
Summer-luna Jul 17, 2023
f30d473
feat: Slack notification ui
Summer-luna Jul 17, 2023
efa2b64
feat: create slack schema
Summer-luna Jul 17, 2023
492cbe4
feat: create slack dto and model
Summer-luna Jul 17, 2023
13e2686
feat: add slackId to employee and send slack message
Summer-luna Jul 17, 2023
466dac7
feat: add send slack message mutation
Summer-luna Jul 17, 2023
e5bb311
fix: return boolean
Summer-luna Jul 17, 2023
bea9e03
fix: object destructing error
Summer-luna Jul 17, 2023
1256b45
feat: create useTimeOut hook
Summer-luna Jul 17, 2023
eae803a
feat: use timeout hook
Summer-luna Jul 17, 2023
5a19f58
feat: send Slack message and display error or success message
Summer-luna Jul 17, 2023
f3b2202
feat: change font family
Summer-luna Jul 17, 2023
3239ade
fix: handle failed to get slack id
Summer-luna Jul 17, 2023
0366ab7
feat: (server) able to send batch Slack message
Summer-luna Jul 18, 2023
c546500
feat: (client) able to send batch Slack message
Summer-luna Jul 18, 2023
71bd0d2
fix: count successfully sent Slack message
Summer-luna Jul 18, 2023
80f9e7b
feat: add comments
Summer-luna Jul 18, 2023
4db7dfb
feat: update project fte schema
Summer-luna Jul 18, 2023
a70e367
fix: remove employee rate
Summer-luna Jul 18, 2023
6f78988
fix: set project fte default to 0
Summer-luna Jul 18, 2023
2110034
feat: update project dto and model
Summer-luna Jul 18, 2023
4349196
fix: update fte validate
Summer-luna Jul 18, 2023
018e3ef
feat: add fte to add and edit form
Summer-luna Jul 18, 2023
2975ff3
fix: add required attribute
Summer-luna Jul 18, 2023
2d09228
fix: update generate and view invoice icon
Summer-luna Jul 18, 2023
7663b1e
fix: icon not change
Summer-luna Jul 18, 2023
a7c45cb
fix: update filter method
Summer-luna Jul 18, 2023
f7e4434
fix: rename the function
Summer-luna Jul 18, 2023
00c42cb
fix: show hover text
Summer-luna Jul 18, 2023
74ffc54
fix: return fte for group by employee and project
Summer-luna Jul 18, 2023
c695ed2
feat: query fte in group by project table
Summer-luna Jul 18, 2023
dca6434
feat: progress bar
Summer-luna Jul 18, 2023
77de332
feat: change circular progress color based on percentage
Summer-luna Jul 19, 2023
d3c07c8
feat: able to insert slack ids automatically
Summer-luna Jul 19, 2023
4b53f68
docs: update employees.json example
Summer-luna Jul 19, 2023
732d166
docs: create readme file
Summer-luna Jul 19, 2023
bdaf672
feat: handle 404 pages for admin and engineer
Summer-luna Jul 19, 2023
c074698
feat: create contract type schema and connect to project
Summer-luna Jul 19, 2023
10680cb
feat: auto insert contract type to db
Summer-luna Jul 19, 2023
e068abe
feat: (server) add contract type
Summer-luna Jul 19, 2023
551951d
feat: (client) add contract type
Summer-luna Jul 19, 2023
dd0c616
feat: return contractTypeId when get group by employee and project re…
Summer-luna Jul 19, 2023
c1d5ada
fix: update ignore files
Summer-luna Jul 19, 2023
cad2086
feat: (client) use contract type when export
Summer-luna Jul 19, 2023
d3e96de
fix: disbled contract type
Summer-luna Jul 19, 2023
639fbec
fix: change font family
Summer-luna Jul 19, 2023
f413afb
fix: add invoice payment status
Summer-luna Jul 21, 2023
de83837
fix: remove throw
Summer-luna Jul 21, 2023
4470e1c
fix: reverse the task status list
Summer-luna Jul 21, 2023
12a3455
fix: reverse the fiscal year dropdown list
Summer-luna Jul 21, 2023
ca41939
feat: specify weekly time track
Summer-luna Jul 21, 2023
54c2d04
feat: able to select users to send Slack message when click send all …
Summer-luna Jul 21, 2023
a2a4244
feat: able to select users to send Slack message when click send all …
Summer-luna Jul 21, 2023
1456381
fix: can not find fiscal year field
Summer-luna Jul 25, 2023
f76e482
fix: change field name from Fiscal Year to FY: Work Completed
Summer-luna Jul 25, 2023
08450df
fix: display dynamic selected employees
Summer-luna Jul 25, 2023
8e3508d
fix: change createDate type from Date to Date with time stamp
Summer-luna Jul 25, 2023
38f6a8d
fix: sort comments by desc order
Summer-luna Jul 25, 2023
45df8ec
fix: display time stamp
Summer-luna Jul 25, 2023
a42bc0b
fix: export time stamp with date as a notes
Summer-luna Jul 25, 2023
11ce2ee
fix: remove console.log
Summer-luna Jul 25, 2023
6e62fc7
fix: rename the header
Summer-luna Jul 25, 2023
86bd410
fix: jsx render warning
Summer-luna Jul 25, 2023
45e0ce1
fix: remove used otherProps
Summer-luna Jul 25, 2023
3e9d1ab
feat: handle custom header cell
Summer-luna Jul 25, 2023
43a649b
feat: create sorted collapsible table
Summer-luna Jul 25, 2023
da369b4
feat: add sortValue to table config
Summer-luna Jul 25, 2023
224264b
merge main into current branch
Summer-luna Jul 25, 2023
e4478b9
feat: make collapse table sorted
Summer-luna Jul 25, 2023
8b691fe
fix: moved basic table to global component folder
Summer-luna Jul 25, 2023
52c8aa8
feat: create sorted basic table
Summer-luna Jul 25, 2023
0c885c2
fix: remove used imports
Summer-luna Jul 25, 2023
c377c78
merge main into current branch
Summer-luna Jul 25, 2023
e7ed0b8
fix: build error
Summer-luna Jul 25, 2023
988bf4a
fix: removed used imports
Summer-luna Jul 25, 2023
6ba65da
Merge branch 'add-contract-type-to-project' into FixingAndImproving
Summer-luna Jul 25, 2023
b0deaeb
Merge branches 'data-sorting' and 'main' of github.com:hicsail/sail-t…
Summer-luna Jul 25, 2023
a61e2b1
Merge branch 'FixingAndImproving' of github.com:hicsail/sail-time-tra…
Summer-luna Jul 25, 2023
9129057
fix: pass Date to sortValue
Summer-luna Jul 25, 2023
76b6973
feat: apply sorted collapsible table to group by employee table
Summer-luna Jul 25, 2023
6f929c6
refactor: create styled date picker and refactor welcomeMessage function
Summer-luna Jul 25, 2023
876e8eb
refactor: removed used imports
Summer-luna Jul 25, 2023
ab86918
refactor: track page table
Summer-luna Jul 25, 2023
414894d
refactor: create useSort custom hook for data sorting
Summer-luna Jul 26, 2023
bc76f72
refactor: remove used imports
Summer-luna Jul 26, 2023
b45718b
refactor: create useSort custom hook for data sorting
Summer-luna Jul 26, 2023
02527ae
refactor: change file structure
Summer-luna Jul 26, 2023
38155f9
refactor: use mui snackbar
Summer-luna Jul 26, 2023
c316c9c
refactor: remove refetch after log the time
Summer-luna Jul 26, 2023
188ef22
refactor: change style of no employee selected
Summer-luna Jul 26, 2023
5ffd297
fix: form validation
Summer-luna Jul 27, 2023
5c88f83
refactor: refetch records with favorite project after adding record
Summer-luna Jul 27, 2023
4d8588c
refactor: reduce code of greeting message
Summer-luna Jul 27, 2023
658d062
fix: using .find instead of map
Summer-luna Jul 27, 2023
175d4c9
refactor: new variable
Summer-luna Jul 27, 2023
faf77d1
fix: remove ...
Summer-luna Jul 27, 2023
2b7ec6d
fix: remove duplicate useSort
Summer-luna Jul 27, 2023
66f8162
fix: create useToggleTheme hook
Summer-luna Jul 27, 2023
d848ae7
fix: change layout
Summer-luna Jul 27, 2023
4af0b76
fix: restructure folders
Summer-luna Jul 27, 2023
f08ddd3
refactor: create snackbar context for displaying success and error me…
Summer-luna Jul 27, 2023
bdbcc26
refactor: showing success message after unfavorite project
Summer-luna Jul 27, 2023
deb4d8d
refactor: use snackbar
Summer-luna Jul 27, 2023
5bb2edf
refactor: change success colors
Summer-luna Jul 27, 2023
c398d37
refactor: add color to light and dark theme
Summer-luna Jul 27, 2023
16cd1e9
refactor: modify warning colors
Summer-luna Jul 27, 2023
08f0807
refactor: modify info colors
Summer-luna Jul 27, 2023
0e33782
refactor: change max width
Summer-luna Jul 27, 2023
91a0f4d
refactor: remove used component
Summer-luna Jul 28, 2023
aa7b877
refactor: change styles and error handling
Summer-luna Jul 28, 2023
04a2544
refactor: handle errors and display success message
Summer-luna Jul 28, 2023
7a4fc1f
refactor: change primary color
Summer-luna Jul 28, 2023
1ea31ca
refactor: change admin navbar style
Summer-luna Jul 28, 2023
7d1e411
refactor: change employee add button
Summer-luna Jul 28, 2023
2ba1416
refactor: change project form layout and implement auto update local …
Summer-luna Jul 28, 2023
d2e929e
refactor: basic table dark theme
Summer-luna Jul 28, 2023
3625264
refactor: contract type chip light and dark theme style
Summer-luna Jul 28, 2023
a482cec
refactor: change button style for light and dark theme
Summer-luna Jul 28, 2023
c0f62f9
refactor: set validateOnChange and validateOnBlur to false
Summer-luna Jul 28, 2023
e919def
refactor: change textfield variant to outlined
Summer-luna Jul 28, 2023
73361e7
refactor: change cell style
Summer-luna Jul 28, 2023
b61f7e0
refactor: show success snackbar
Summer-luna Jul 28, 2023
ef1f2a4
refactor: change invoice ui style
Summer-luna Jul 28, 2023
31eb516
refactor: use sorted table in invoice detail and use snackbar
Summer-luna Jul 28, 2023
5d41a30
refactor: removed used imports
Summer-luna Jul 28, 2023
6aa59d4
refactor: admin dark theme
Summer-luna Jul 31, 2023
4d6bebc
refactor: remove used imports
Summer-luna Jul 31, 2023
e14b3ec
refactor: extract Toolbar component
Summer-luna Jul 31, 2023
a716958
refactor: delete used component
Summer-luna Jul 31, 2023
08ad26b
refactor: remove align
Summer-luna Jul 31, 2023
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
43 changes: 23 additions & 20 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Employee } from '@pages/Employee/Employee';

import { GraphqlProvider } from '@graphql/graphql-provider';
import { Project } from '@pages/Project/Project';
import { Track } from '@pages/Track/track';
import { Track } from '@pages/Track/Track';
import { Paths } from '@constants/paths';
import { Admin } from '@pages/Admin/Admin';
import { ThemeProvider } from '@theme/theme.provider';
Expand All @@ -20,6 +20,7 @@ import { InvoiceDetails } from '@pages/Invoice/InvoiceDetails';
import { DateRangeProvider } from '@context/reportFilter.context';
import { Export } from '@pages/Invoice/Export';
import { NotFoundAdmin } from '@pages/Not_Find/NotFindAdmin';
import { SnackBarProvider } from '@context/snackbar.context';

function App() {
if (enLocale && enLocale.options) {
Expand All @@ -35,27 +36,29 @@ function App() {
<DateProvider>
<EmployeeProvider>
<DateRangeProvider>
<Routes>
<Route path={Paths.TRACK} element={<TrackLayout />}>
<Route path={Paths.TRACK} element={<Track />} />
</Route>
<Route path={Paths.ADMIN} element={<Admin />}>
<Route path={Paths.PROJECT_lIST} element={<Project />}>
<Route path={Paths.EDIT_PROJECT} />
<Route path={Paths.ADD_PROJECT} />
<SnackBarProvider>
<Routes>
<Route path={Paths.TRACK} element={<TrackLayout />}>
<Route path={Paths.TRACK} element={<Track />} />
</Route>
<Route path={Paths.EMPLOYEE_lIST} element={<Employee />}>
<Route path={Paths.EDIT_EMPLOYEE} />
<Route path={Paths.ADD_EMPLOYEE} />
<Route path={Paths.ADMIN} element={<Admin />}>
<Route path={Paths.PROJECT_lIST} element={<Project />}>
<Route path={Paths.EDIT_PROJECT} />
<Route path={Paths.ADD_PROJECT} />
</Route>
<Route path={Paths.EMPLOYEE_lIST} element={<Employee />}>
<Route path={Paths.EDIT_EMPLOYEE} />
<Route path={Paths.ADD_EMPLOYEE} />
</Route>
<Route path={Paths.REPORT} element={<Report />} />
<Route path={Paths.INVOICE} element={<Invoice />} />
<Route path={Paths.INVOICE_DETAIL} element={<InvoiceDetails />} />
<Route path={Paths.EXPORT_INVOICE} element={<Export />} />
<Route path={`${Paths.ADMIN}/*`} element={<NotFoundAdmin page="admin" />} />
</Route>
<Route path={Paths.REPORT} element={<Report />} />
<Route path={Paths.INVOICE} element={<Invoice />} />
<Route path={Paths.INVOICE_DETAIL} element={<InvoiceDetails />} />
<Route path={Paths.EXPORT_INVOICE} element={<Export />} />
<Route path={`${Paths.ADMIN}/*`} element={<NotFoundAdmin page="admin" />} />
</Route>
<Route path="*" element={<NotFoundAdmin />} />
</Routes>
<Route path="*" element={<NotFoundAdmin />} />
</Routes>
</SnackBarProvider>
</DateRangeProvider>
</EmployeeProvider>
</DateProvider>
Expand Down
27 changes: 27 additions & 0 deletions packages/client/src/components/CustomTableContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { StyledPaper } from '@components/StyledPaper';
import { PaperProps, TableContainer } from '@mui/material';
import { FC } from 'react';

interface CustomTableContainerProps extends PaperProps {
children: React.ReactNode;
sx?: any;
}

export const CustomTableContainer: FC<CustomTableContainerProps> = ({ children, sx, ...otherProps }) => {
return (
<TableContainer
component={StyledPaper}
elevation={0}
sx={{
boxShadow: (theme) =>
theme.palette.mode === 'light'
? 'rgba(145, 158, 171, 0.2) 0px 0px 2px 0px, rgba(145, 158, 171, 0.12) 0px 12px 24px -4px'
: 'rgba(0, 0, 0, 0.2) 0px 0px 2px 0px, rgba(0, 0, 0, 0.12) 0px 12px 24px -4px;',
...sx
}}
{...otherProps}
>
{children}
</TableContainer>
);
};
93 changes: 62 additions & 31 deletions packages/client/src/components/StyledComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { Box, Button, styled, TextField } from '@mui/material';
import { alpha, Box, Button, styled, TextField } from '@mui/material';
import DialogContent from '@mui/material/DialogContent';
import TextareaAutosize from '@mui/base/TextareaAutosize';
import TableRow from '@mui/material/TableRow';

export const DefaultTextInput = styled(TextField)(({ theme, variant }) => ({
backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey['100'] : theme.palette.grey['700'],
color: theme.palette.mode === 'light' ? theme.palette.grey['800'] : 'white',
...(theme.palette.mode === 'dark' && {
backgroundColor: variant === 'outlined' ? theme.palette.grey['800'] : theme.palette.grey['700'],
color: theme.palette.grey['800'],
'& fieldset': { border: variant === 'outlined' ? `1px solid ${theme.palette.grey[700]}` : 'none' }
}),
...(theme.palette.mode === 'light' && {
backgroundColor: variant === 'outlined' ? theme.palette.common.white : theme.palette.grey['100'],
color: variant === 'outlined' ? theme.palette.grey['800'] : theme.palette.grey['800'],
'& fieldset': { border: variant === 'outlined' ? `1px solid ${theme.palette.grey[300]}` : 'none' }
}),
borderRadius: '8px',
'& fieldset': { border: variant === 'outlined' ? `1px solid ${theme.palette.grey[300]}` : 'none' },
'& input[type=number]': {
MozAppearance: 'textfield'
},
Expand Down Expand Up @@ -60,8 +68,7 @@ export const StyledTableBox = styled(Box)(({ theme }) => ({
}));

export const CustomStyledFormDialog = styled(DialogContent)(({ theme }) => ({
maxWidth: '600px',
width: '600px',
minWidth: '600px',
padding: '4rem',
backgroundColor: theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey['800']
}));
Expand All @@ -85,28 +92,52 @@ export const DefaultOutlinedButton = styled(Button)(({ theme }) => ({
})
}));

export const StyledTextarea = styled(TextareaAutosize)(
({ theme }) => `
width: 100%;
height: 200px;
font-size: 0.875rem;
font-weight: 400;
line-height: 1.5;
padding: 12px;
border-radius: 10px;
color: ${theme.palette.mode === 'dark' ? theme.palette.grey['300'] : theme.palette.grey['900']};
background: ${theme.palette.mode === 'dark' ? theme.palette.grey['900'] : '#fff'};
border: 1px solid ${theme.palette.mode === 'dark' ? theme.palette.grey['700'] : theme.palette.grey['100']};
resize: none;
font-family: 'Rubik', sans-serif;

&:hover {
border-color: black;
}

&:focus {
border-color: black;
outline: 1.5px solid black;
}
`
);
export const StyledTextarea = styled(TextareaAutosize)(({ theme }) => ({
width: '100%',
height: '200px',
fontWeight: 'medium',
lineHeight: 1.5,
padding: '12px',
borderRadius: '10px',
color: theme.palette.mode === 'light' ? theme.palette.grey['900'] : theme.palette.common.white,
backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey['100'] : theme.palette.grey['800'],
border: `1px solid ${theme.palette.mode === 'light' ? theme.palette.grey['400'] : theme.palette.grey['700']}`,
resize: 'none',
fontFamily: 'Rubik, sans-serif',
'&:hover': {
borderColor: theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white
},
'&:focus': {
outline: `2px solid ${theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white}`
}
}));

export const StyledTableHeadRow = styled(TableRow)(({ theme }) => ({
'& .MuiTableCell-root': {
color: theme.palette.mode === 'light' ? theme.palette.grey[600] : theme.palette.grey[500],
backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey[200] : alpha(theme.palette.grey[500], 0.12),
fontWeight: 'medium',
border: 'none'
}
}));

export const StyledTableDataRow = styled(TableRow)(({ theme }) => ({
'& .MuiTableCell-root': {
borderBottom: '1px dashed',
borderColor: theme.palette.mode === 'light' ? theme.palette.grey[200] : 'rgb(46, 50, 54)'
},
'&:hover': { backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey[100] : alpha(theme.palette.grey[500], 0.08) }
}));

interface StyledNestedTableDataRowProps {
open: boolean;
}

export const StyledNestedTableDataRow = styled(TableRow, { shouldForwardProp: (prop) => prop !== 'open' })<StyledNestedTableDataRowProps>(({ open, theme }) => ({
...(theme.palette.mode === 'light' && {
backgroundColor: open ? theme.palette.grey[200] : 'inherit'
}),
...(theme.palette.mode === 'dark' && {
backgroundColor: open ? alpha(theme.palette.grey[500], 0.12) : 'inherit'
})
}));
22 changes: 22 additions & 0 deletions packages/client/src/components/StyledDatePicker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { CustomDatePickerLayout } from '@components/CustomDatePickerLayout';
import { DatePicker } from '@mui/x-date-pickers';
import { DatePickerProps } from '@mui/lab';
import { FC } from 'react';

interface StyledDatePickerProps extends DatePickerProps<any> {}
export const StyledDatePicker: FC<StyledDatePickerProps> = (props) => {
return (
<DatePicker
sx={{
'& .MuiOutlinedInput-root': {
'& fieldset': {
borderColor: 'grey.300',
color: 'grey.500'
}
}
}}
slots={{ layout: CustomDatePickerLayout }}
{...props}
/>
);
};
5 changes: 3 additions & 2 deletions packages/client/src/components/StyledPaper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ const NewPaper = styled(Paper)(({ theme }) => ({
mb: 2,
padding: '1rem',
display: 'flex',
flexDirection: 'column'
flexDirection: 'column',
borderRadius: '8px'
}));

interface StyledPaperProps extends PaperProps {
children: ReactNode[] | ReactNode;
children: ReactNode;
}
export const StyledPaper: FC<StyledPaperProps> = ({ children, ...otherOptions }) => {
return <NewPaper {...otherOptions}>{children}</NewPaper>;
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/components/form/FormDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface FormDialogProps {

export const FormDialog: FC<FormDialogProps> = ({ open, children, onClose }) => {
return (
<Dialog open={open} onClose={onClose}>
<Dialog open={open} onClose={onClose} maxWidth="md">
<CustomStyledFormDialog>{children}</CustomStyledFormDialog>
</Dialog>
);
Expand Down
3 changes: 3 additions & 0 deletions packages/client/src/components/form/ObserverTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const ObserverTextInput: FC<TextInputProps> = (props) => {
disabled={props.disabled || isSubmitting}
error={!!errors[props.name]}
helperText={(touched[props.name] && errors[props.name]) as string}
sx={{
'.MuiFormHelperText-root ': { width: '120px', marginRight: 0 }
}}
/>
</FormControl>
);
Expand Down
31 changes: 9 additions & 22 deletions packages/client/src/components/table/BasicTable.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { StyledPaper } from '@components/StyledPaper';
import { Table, TableBody, TableHead, TableRow, TableContainer, TablePagination } from '@mui/material';
import { Table, TableBody, TableHead, TablePagination } from '@mui/material';
import { FC, Fragment, ReactNode, useState } from 'react';
import TableCell from '@mui/material/TableCell';
import { StyledTableDataRow, StyledTableHeadRow } from '@components/StyledComponent';
import { CustomTableContainer } from '@components/CustomTableContainer';

export interface BasicTableProps {
rows: any[];
columns: any[];
toolbar?: JSX.Element;
toolbar?: ReactNode;
keyFun: (row: any) => string;
initialState?: any;
sx?: any;
Expand Down Expand Up @@ -36,11 +37,7 @@ export const BasicTable: FC<BasicTableProps> = ({ rows, columns, toolbar, keyFun
if (column.header) return <Fragment key={column.field}>{column.header()}</Fragment>;

return (
<TableCell
key={column.field}
align={column.headerAlign ? column.headerAlign : 'left'}
sx={{ width: column.width ? column.width : '150px', color: 'grey.600', fontWeight: 'medium', bgcolor: 'grey.200', border: 'none' }}
>
<TableCell key={column.field} align={column.headerAlign ? column.headerAlign : 'left'} sx={{ width: column.width ? column.width : '150px' }}>
{column.header ? column.header() : column.headerName.toUpperCase()}
</TableCell>
);
Expand All @@ -53,25 +50,15 @@ export const BasicTable: FC<BasicTableProps> = ({ rows, columns, toolbar, keyFun
</TableCell>
));

return (
<TableRow
key={keyFun(row)}
sx={{
'& .MuiTableCell-root': { fontWeight: 'regular', fontSize: '1rem', borderBottom: '1px dashed', borderColor: 'grey.200' },
'&:hover': { backgroundColor: 'grey.100' }
}}
>
{renderCells}
</TableRow>
);
return <StyledTableDataRow key={keyFun(row)}>{renderCells}</StyledTableDataRow>;
});

return (
<TableContainer component={StyledPaper} elevation={0}>
<CustomTableContainer>
{toolbar}
<Table sx={{ minWidth: 650 }}>
<TableHead>
<TableRow>{renderedHeaders}</TableRow>
<StyledTableHeadRow>{renderedHeaders}</StyledTableHeadRow>
</TableHead>
<TableBody>{renderRows}</TableBody>
</Table>
Expand All @@ -86,6 +73,6 @@ export const BasicTable: FC<BasicTableProps> = ({ rows, columns, toolbar, keyFun
onRowsPerPageChange={handleChangeRowsPerPage}
/>
)}
</TableContainer>
</CustomTableContainer>
);
};
4 changes: 2 additions & 2 deletions packages/client/src/components/table/SortedBasicTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react';
import TableCell from '@mui/material/TableCell';
import { TableSortLabel } from '@mui/material';
import { BasicTable, BasicTableProps } from '@components/table/BasicTable';
import { useSort } from '../../utils/useSort';
import { useSort } from '../../hooks/useSort';

interface SortedBasicTableProps extends BasicTableProps {
defaultOrderBy: string;
Expand All @@ -21,7 +21,7 @@ export const SortedBasicTable: FC<SortedBasicTableProps> = (props) => {
...column,
header: () => {
return (
<TableCell align="left" sx={{ width: column.width ? column.width : '150px', color: 'grey.600', fontWeight: 'medium', bgcolor: 'grey.200', border: 'none' }}>
<TableCell align="left" sx={{ width: column.width ? column.width : '150px' }}>
<TableSortLabel active={orderBy === column.field} direction={orderBy === column.field ? order : 'asc'} onClick={() => setSortColumn(column.field)}>
{column.headerName}
</TableSortLabel>
Expand Down
46 changes: 46 additions & 0 deletions packages/client/src/context/snackbar.context.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { createContext, FC, ReactNode, useContext, useState } from 'react';
import { AlertColor, Snackbar } from '@mui/material';
import { Alert } from '@mui/lab';

const SnackbarContext = createContext<SnackBarContextProps>({} as SnackBarContextProps);

interface SnackBarProviderProps {
children: ReactNode;
}

interface SnackBarContextProps {
toggleSnackBar: (message: string, { variant }: { variant: AlertColor }) => void;
handleSnackBarOpen: () => void;
}

export const SnackBarProvider: FC<SnackBarProviderProps> = ({ children }) => {
const [open, setOpen] = useState<boolean>(false);
const [message, setMessage] = useState<string>('');
const [variant, setVariant] = useState<AlertColor>('success');

const handleSnackBarClose = () => setOpen(false);
const handleSnackBarOpen = () => setOpen(true);

const toggleSnackBar = (message: string, { variant }: { variant: AlertColor }) => {
handleSnackBarOpen();
setMessage(message);
setVariant(variant);
};

return (
<SnackbarContext.Provider value={{ handleSnackBarOpen, toggleSnackBar }}>
{children}
<Snackbar open={open} autoHideDuration={2000} onClose={handleSnackBarClose} anchorOrigin={{ vertical: 'top', horizontal: 'center' }}>
<Alert
onClose={handleSnackBarClose}
severity={variant}
sx={{ fontWeight: 'medium', backgroundColor: variant === 'success' ? 'green.dark' : '', color: variant === 'success' ? 'white' : '' }}
>
{message}
</Alert>
</Snackbar>
</SnackbarContext.Provider>
);
};

export const useSnackBar = () => useContext(SnackbarContext);
Loading
Loading