diff --git a/.github/workflows/client-deploy-on-merge.yml b/.github/workflows/deploy-on-merge.yml similarity index 55% rename from .github/workflows/client-deploy-on-merge.yml rename to .github/workflows/deploy-on-merge.yml index caa636a..f7052ff 100644 --- a/.github/workflows/client-deploy-on-merge.yml +++ b/.github/workflows/deploy-on-merge.yml @@ -7,7 +7,28 @@ on: branches: - master jobs: + firestore_deploy: + runs-on: ubuntu-latest + env: + working-directory: ./firestore + steps: + - uses: actions/checkout@v3 + - run: npm run deploy + working-directory: ${{env.working-directory}} + + functions_deploy: + needs: firestore_deploy + runs-on: ubuntu-latest + env: + working-directory: ./functions + steps: + - uses: actions/checkout@v3 + - run: npm ci && npm run build + working-directory: ${{env.working-directory}} + - run: npm run deploy + client_deploy: + needs: [firestore_deploy, functions_deploy] runs-on: ubuntu-latest env: working-directory: ./client @@ -21,3 +42,4 @@ jobs: firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POOLSCORE_1973 }}' channelId: live projectId: poolscore-1973 + diff --git a/client/src/App.tsx b/client/src/App.tsx index 3fc49b9..e453552 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -2,10 +2,11 @@ import { CssBaseline, ThemeProvider, createTheme } from '@mui/material'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { LocalizationProvider } from '@mui/x-date-pickers'; -import { Store } from './store/Store'; import Router from './Router'; import AuthProvider from './store/AuthProvider'; import ClubProvider from './store/ClubProvider'; +import TableProvider from './store/TableProvider'; +import { Store } from './store/Store'; const darkTheme = createTheme({ palette: { @@ -19,9 +20,11 @@ export default function App() { - - - + + + + + diff --git a/client/src/components/AppDrawer.tsx b/client/src/components/AppDrawer.tsx index 8ac802a..65ebe4a 100644 --- a/client/src/components/AppDrawer.tsx +++ b/client/src/components/AppDrawer.tsx @@ -5,7 +5,7 @@ import { } from '@mui/material'; import { CalendarMonth, - Close, Home, Logout, TableRestaurant, + Close, Home, Login, Logout, TableRestaurant, } from '@mui/icons-material'; import { useAuth } from '../store/AuthProvider'; import { footerText } from './Footer'; @@ -22,8 +22,11 @@ const drawerBoxSx = { export default memo((props: AppDrawerProps) => { const theme = useTheme(); - const { userId, userIdLoading, signOut } = useAuth(); + const { + userId, userIdLoading, signOut, admin, + } = useAuth(); const isLoggedIn = userId && !userIdLoading; + const isAdmin = isLoggedIn && admin; const drawerList = ( @@ -43,18 +46,7 @@ export default memo((props: AppDrawerProps) => { - { /* isLoggedIn ? null - : ( - - - - - - - - - ) */} - { isLoggedIn + { isAdmin ? ( <> @@ -74,17 +66,27 @@ export default memo((props: AppDrawerProps) => { - - - - - - - - - ) - : null} + ) : null } + { isLoggedIn ? ( + + + + + + + + + ) : ( + + + + + + + + + )} diff --git a/client/src/components/Header.tsx b/client/src/components/Header.tsx index cfab79f..4116af0 100644 --- a/client/src/components/Header.tsx +++ b/client/src/components/Header.tsx @@ -10,8 +10,11 @@ import { useAuth } from '../store/AuthProvider'; import AppDrawer from './AppDrawer'; export default function Header() { - const { userId, userIdLoading, signOut } = useAuth(); - const loggedIn = userId && !userIdLoading; + const { + userId, userIdLoading, signOut, admin, + } = useAuth(); + const isLoggedIn = userId && !userIdLoading; + const isAdmin = isLoggedIn && admin; const [open, setOpen] = useState(false); const closeDrawer = useCallback(() => { setOpen(false); }, []); @@ -39,14 +42,15 @@ export default function Header() { <> - { loggedIn ? ( + { isAdmin ? ( <> - + - - ) - : null /* */} + ) : null } + { isLoggedIn + ? + : } ); diff --git a/client/src/components/HomeLayout.tsx b/client/src/components/HomeLayout.tsx index 2ec9432..9487c79 100644 --- a/client/src/components/HomeLayout.tsx +++ b/client/src/components/HomeLayout.tsx @@ -1,4 +1,6 @@ -import { Stack, useMediaQuery, useTheme } from '@mui/material'; +import { + Container, Stack, useMediaQuery, useTheme, +} from '@mui/material'; import Footer from './Footer'; import Header from './Header'; @@ -13,7 +15,9 @@ export default function Layout({ children }: LayoutProps) { return (
- {children} + + {children} + {isDesktop ?