Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.idea/*
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

28 changes: 28 additions & 0 deletions backend/package-lock.json

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

24 changes: 24 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
7 changes: 7 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 120
}
30 changes: 30 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
10 changes: 10 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import eslint from '@eslint/js';
import tslint from 'typescript-eslint';

export default [
eslint.configs.recommended,
...tslint.configs.recommended,
{
ignores: ['node_modules', 'dist'],
},
];
13 changes: 13 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>meiro - FE test scenario</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
47 changes: 47 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint .",
"format:check": "prettier --check .",
"format:fix": "prettier --write ."
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fontsource/open-sans": "^5.0.28",
"@mui/icons-material": "^5.15.18",
"@mui/material": "^5.15.18",
"@tanstack/react-query": "^5.37.1",
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.1",
"tslib": "^2.6.2"
},
"devDependencies": {
"@eslint/js": "^9.3.0",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.0.1",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"prettier": "^3.2.5",
"typescript": "^5.2.2",
"typescript-eslint": "^7.10.0",
"vite": "^5.2.0"
}
}
1 change: 1 addition & 0 deletions frontend/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions frontend/src/App/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ThemeProvider, CssBaseline } from '@mui/material';
import { theme } from '../styles';
import AppRouter from './AppRouter';

import '@fontsource/open-sans/300.css';
import '@fontsource/open-sans/500.css';
import '@fontsource/open-sans/700.css';
import '@fontsource/open-sans/800.css';

const queryClient = new QueryClient();

const App = () => (
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<CssBaseline />
<AppRouter />
</ThemeProvider>
</QueryClientProvider>
);

export default App;
43 changes: 43 additions & 0 deletions frontend/src/App/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { lazy } from 'react';
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
import { ROUTES } from '../constants';
import { PageLayout, PagePreloader } from '../components';

const Error = lazy(() => import('../modules/Error/Error'));
const Home = lazy(() => import('../modules/Home/Home'));
const Attributes = lazy(() => import('../modules/Attributes/Attributes'));

const AppRouter = () => {
const router = createBrowserRouter(
[
{
path: '*',
element: <Error />,
},
{
element: <PageLayout />,
children: [
{
path: ROUTES.home.path,
element: <Home />,
},
{
path: ROUTES.attributes.path,
element: <Attributes />,
children: [
{
path: `${ROUTES.attributes.path}/:id`,
element: <Attributes />,
},
],
},
],
},
],
{ basename: '' }
);

return <RouterProvider router={router} fallbackElement={<PagePreloader />} />;
};

export default AppRouter;
1 change: 1 addition & 0 deletions frontend/src/App/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as App } from './App';
1 change: 1 addition & 0 deletions frontend/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions frontend/src/components/ConfirmDialog/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { ReactNode } from 'react';
import { Dialog, DialogTitle, DialogContent, DialogActions, IconButton, Button } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import { WithChildren } from '../../types';

export interface ConfirmDialogProps extends WithChildren {
title?: ReactNode;
open: boolean;
onClose: () => void;
onConfirm: () => void;
}

const ConfirmDialog = ({ children, title, open, onClose, onConfirm }: ConfirmDialogProps) => {
const confirmHandler = () => {
onClose();
onConfirm();
};

return (
<Dialog open={open} onClose={onClose} maxWidth="sm" fullWidth>
{title && <DialogTitle>{title}</DialogTitle>}
<IconButton
aria-label="close"
sx={{
position: 'absolute',
right: 8,
top: 8,
color: (theme) => theme.palette.grey[500],
}}
onClick={onClose}
>
<CloseIcon />
</IconButton>
<DialogContent dividers>{children}</DialogContent>
<DialogActions>
<Button variant="outlined" onClick={confirmHandler}>
Confirm
</Button>
<Button onClick={onClose}>Cancel</Button>
</DialogActions>
</Dialog>
);
};

export default ConfirmDialog;
2 changes: 2 additions & 0 deletions frontend/src/components/ConfirmDialog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ConfirmDialog } from './ConfirmDialog';
export type { ConfirmDialogProps } from './ConfirmDialog';
27 changes: 27 additions & 0 deletions frontend/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { styled, Box, Container, Typography, Stack, BoxProps } from '@mui/material';
import { PROJECT } from '../../config';
import { CONTAINER_MAX_WIDTH_DEFAULT } from '../../constants';

const Wrapper = styled(Box)(({ theme: { spacing } }) => ({
padding: spacing(2),
}));

interface FooterProps {
wrapperProps?: Partial<Omit<BoxProps, 'component'>>;
}

const Footer = ({ wrapperProps }: FooterProps) => {
return (
<Wrapper component="footer" {...wrapperProps}>
<Container maxWidth={CONTAINER_MAX_WIDTH_DEFAULT}>
<Stack>
<Typography variant="caption" sx={{ textAlign: 'center' }}>
{PROJECT.meta.name} - {PROJECT.meta.description} ({PROJECT.meta.year})
</Typography>
</Stack>
</Container>
</Wrapper>
);
};

export default Footer;
1 change: 1 addition & 0 deletions frontend/src/components/Footer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Footer } from './Footer';
Loading