Skip to content

Commit

Permalink
Merge pull request #164 from daithihearn/material-ui-migration
Browse files Browse the repository at this point in the history
removing react-strap and using only material-ui
  • Loading branch information
daithihearn authored May 17, 2023
2 parents ca35d84 + 7d293fd commit ed2a382
Show file tree
Hide file tree
Showing 46 changed files with 1,218 additions and 1,420 deletions.
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "6.1.4",
"version": "7.0.0",
"description": "React frontend for the Cards 110",
"author": "Daithi Hearn",
"license": "MIT",
Expand All @@ -10,10 +10,11 @@
"@coreui/coreui": "^4.2.6",
"@coreui/icons": "^3.0.0",
"@coreui/react": "^4.6.0",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.11",
"@mui/x-data-grid": "^6.4.0",
"@popperjs/core": "^2.5.4",
"@reduxjs/toolkit": "^1.9.3",
"@types/jest": "^29.4.0",
Expand All @@ -27,7 +28,6 @@
"chart.js": "^4.2.1",
"core-js": "^3.29.0",
"crypto-js": "4.1.1",
"flag-icon-css": "^4.1.7",
"font-awesome": "^4.7.0",
"heic2any": "^0.0.3",
"jwt-decode": "^3.1.2",
Expand All @@ -39,16 +39,13 @@
"react-block-ui": "^1.3.3",
"react-chartjs-2": "5",
"react-confetti": "^6.1.0",
"react-data-table-component": "7.5.3",
"react-dom": "18.2.0",
"react-redux": "^8.0.5",
"react-router": "^6.8.2",
"react-router-config": "^5.1.1",
"react-router-dom": "^6.8.2",
"react-simple-pull-to-refresh": "^1.3.3",
"react-stomp-hooks": "2.1.0",
"react-viewer": "^3.2.2",
"reactstrap": "9.1.6",
"semantic-ui-css": "^2.4.1",
"simple-line-icons": "^2.5.5",
"styled-components": "^5.3.8",
Expand Down
Binary file added public/assets/img/dummy-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added public/assets/img/mycards-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed public/cards/originals/carpet.jpg
Binary file not shown.
Binary file removed public/cards/originals/carpet2.jpg
Binary file not shown.
Binary file removed public/cards/originals/carpet3.jpg
Binary file not shown.
Binary file removed public/cards/originals/carpet4.jpg
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"short_name": "Cards 110",
"name": "Cards 110",
"version": "6.1.4",
"version": "7.0.0",
"icons": [
{
"src": "./assets/favicon.png",
Expand Down
42 changes: 31 additions & 11 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ import Home from "./pages/Home/Home"
import Game from "./pages/Game/Game"
import Layout from "./pages/Layout/Layout"
import ErrorPage from "./pages/Error/Error"
import { lightTheme, darkTheme } from "Themes"
import {
createTheme,
CssBaseline,
ThemeProvider,
useMediaQuery,
} from "@mui/material"

const AUTHO_DOMAIN = process.env.REACT_APP_AUTH0_DOMAIN as string
const AUTH0_CLIENT_ID = process.env.REACT_APP_AUTH0_CLIENT_ID as string
Expand All @@ -46,18 +53,31 @@ const router = createBrowserRouter(
)

const App = () => {
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)")

const theme = React.useMemo(
() =>
createTheme({
...(prefersDarkMode ? darkTheme : lightTheme),
}),
[prefersDarkMode],
)

return (
<Provider store={store}>
<SnackbarProvider maxSnack={3}>
<Auth0Provider
domain={AUTHO_DOMAIN}
clientId={AUTH0_CLIENT_ID}
useRefreshTokens={true}>
<MyProfileSync />
<RouterProvider router={router} />
</Auth0Provider>
</SnackbarProvider>
</Provider>
<ThemeProvider theme={theme}>
<Provider store={store}>
<SnackbarProvider maxSnack={3}>
<Auth0Provider
domain={AUTHO_DOMAIN}
clientId={AUTH0_CLIENT_ID}
useRefreshTokens={true}>
<CssBaseline />
<MyProfileSync />
<RouterProvider router={router} />
</Auth0Provider>
</SnackbarProvider>
</Provider>
</ThemeProvider>
)
}
export default App
189 changes: 189 additions & 0 deletions src/Themes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
import { ThemeOptions } from "@mui/material"

export const darkTheme: ThemeOptions = {
components: {
MuiModal: {
styleOverrides: {
root: {
display: "flex",
alignItems: "center",
justifyContent: "center",
},
},
},
MuiCssBaseline: {
styleOverrides: {
".carpet": {
background:
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='100%25' width='100%25'%3E%3Cdefs%3E%3Cpattern id='doodad' width='37' height='37' viewBox='0 0 40 40' patternUnits='userSpaceOnUse' patternTransform='rotate(60)'%3E%3Crect width='100%25' height='100%25' fill='rgba(34, 84, 61,1)'/%3E%3Ccircle cx='20' cy='20' r='1' fill='%23f6e05e'/%3E%3Ccircle cx='30' cy='20' r='1' fill='%23d69e2e'/%3E%3Ccircle cx='20' cy='30' r='1' fill='%23d69e2e'/%3E%3Ccircle cx='10' cy='20' r='1' fill='%23d69e2e'/%3E%3Ccircle cx='20' cy='10' r='1' fill='%23d69e2e'/%3E%3Ccircle cx='30' cy='20' r='1' fill='%23d69e2e'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23doodad)' height='200%25' width='200%25'/%3E%3C/svg%3E \")",
position: "fixed",
width: "100%",
height: "100%",
overflow: "overlay",
},
".dummy": {
backgroundImage: "url('/assets/img/dummy-light.png')",
},
".cards-background": {
backgroundImage: "url('/assets/img/mycards-light.png')",
},
},
},
},
palette: {
mode: "dark",
primary: {
main: "#595959", // dark grey (instead of soft black)
},
secondary: {
main: "#F8F8F8", // soft white (instead of soft black)
},
error: {
main: "#FF7F7F", // soft red
},
warning: {
main: "#7F7FFF", // soft blue
},
info: {
main: "#7FFF7F", // soft green
},
background: {
default: "#303030", // dark grey for contrast to dark grey primary
paper: "#424242", // even darker grey
},
text: {
primary: "#F8F8F8", // soft white (instead of soft black)
secondary: "#F3F3F3", // softer white
},
},
typography: {
fontFamily: "sans-serif",
h1: {
fontSize: "2rem",
fontWeight: "bold",
},
h2: {
fontSize: "1.5rem",
fontWeight: "bold",
},
h3: {
fontSize: "1.25rem",
fontWeight: "bold",
},
h4: {
fontSize: "1rem",
fontWeight: "bold",
},
h5: {
fontSize: "0.875rem",
fontWeight: "bold",
},
body1: {
fontSize: "1rem",
lineHeight: 1.5,
},
body2: {
fontSize: "0.875rem",
lineHeight: 1.5,
},
button: {
fontSize: "0.875rem",
fontWeight: "bold",
textTransform: "none",
},
},
}

export const lightTheme: ThemeOptions = {
components: {
MuiModal: {
styleOverrides: {
root: {
display: "flex",
alignItems: "center",
justifyContent: "center",
},
},
},
MuiCssBaseline: {
styleOverrides: {
".carpet": {
background:
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='100%25' width='100%25'%3E%3Cdefs%3E%3Cpattern id='doodad' width='37' height='37' viewBox='0 0 40 40' patternUnits='userSpaceOnUse' patternTransform='rotate(60)'%3E%3Crect width='100%25' height='100%25' fill='rgba(178, 245, 234,1)'/%3E%3Ccircle cx='20' cy='20' r='1' fill='rgba(45, 55, 72,1)'/%3E%3Ccircle cx='30' cy='20' r='1' fill='rgba(34, 84, 61,1)'/%3E%3Ccircle cx='20' cy='30' r='1' fill='rgba(34, 84, 61,1)'/%3E%3Ccircle cx='10' cy='20' r='1' fill='rgba(34, 84, 61,1)'/%3E%3Ccircle cx='20' cy='10' r='1' fill='rgba(34, 84, 61,1)'/%3E%3Ccircle cx='30' cy='20' r='1' fill='rgba(34, 84, 61,1)'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23doodad)' height='200%25' width='200%25'/%3E%3C/svg%3E \")",
position: "fixed",
width: "100%",
height: "100%",
overflow: "overlay",
},
".dummy": {
backgroundImage: "url('/assets/img/dummy-dark.png')",
},
".cards-background": {
backgroundImage: "url('/assets/img/mycards-dark.png')",
},
},
},
},
palette: {
mode: "light",
primary: {
main: "#F8F8F8", // soft white
},
secondary: {
main: "#595959", // soft black
},
error: {
main: "#FF7F7F", // soft red
},
warning: {
main: "#7F7FFF", // soft blue
},
info: {
main: "#7FFF7F", // soft green
},
background: {
default: "#F0F0F0", // soft grey for slight contrast to soft white
paper: "#F8F8F8", // soft white
},
text: {
primary: "#595959", // soft black
secondary: "#5E5E5E", // softer black
},
},
typography: {
fontFamily: "sans-serif",
h1: {
fontSize: "2rem",
fontWeight: "bold",
},
h2: {
fontSize: "1.5rem",
fontWeight: "bold",
},
h3: {
fontSize: "1.25rem",
fontWeight: "bold",
},
h4: {
fontSize: "1rem",
fontWeight: "bold",
},
h5: {
fontSize: "0.875rem",
fontWeight: "bold",
},
body1: {
fontSize: "1rem",
lineHeight: 1.5,
},
body2: {
fontSize: "0.875rem",
lineHeight: 1.5,
},
button: {
fontSize: "0.875rem",
fontWeight: "bold",
textTransform: "none",
},
},
}
Binary file removed src/assets/img/brand/footer.png
Binary file not shown.
Binary file removed src/assets/img/brand/logo.png
Binary file not shown.
Binary file removed src/assets/img/cloth.jpg
Binary file not shown.
Binary file removed src/assets/img/wood.jpg
Binary file not shown.
2 changes: 2 additions & 0 deletions src/caches/GameSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const initialState: GameState = {
isMyGo: false,
iamGoer: false,
iamDealer: false,
iamAdmin: false,
cards: [],
status: GameStatus.NONE,
players: [],
Expand Down Expand Up @@ -94,6 +95,7 @@ export const getMaxCall = createSelector(getGame, game => game.maxCall || 0)
export const getIsMyGo = createSelector(getGame, game => game.isMyGo)
export const getIamGoer = createSelector(getGame, game => game.iamGoer)
export const getIamDealer = createSelector(getGame, game => game.iamDealer)
export const getIamAdmin = createSelector(getGame, game => game.iamAdmin)
export const getIHavePlayed = createSelector(getGame, game => {
const myPosition = game.players.findIndex(p => p.id === game.me?.id)
const currentPlayerPosition = game.players.findIndex(
Expand Down
Loading

0 comments on commit ed2a382

Please sign in to comment.