Skip to content

Commit

Permalink
Merge pull request #59 from bde-isima/staging
Browse files Browse the repository at this point in the history
Add status display, allow to hide clubs and parts, remove payement
  • Loading branch information
Topin2001 authored Oct 29, 2024
2 parents a59ed08 + e5c9dad commit 95f7a3f
Show file tree
Hide file tree
Showing 29 changed files with 195 additions and 548 deletions.
53 changes: 29 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,41 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/javascript-node-postgres
// Update the VARIANT arg in docker-compose.yml to pick a Node.js version
{
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/refs/heads/main/schemas/devContainer.schema.json",
"name": "bde-isima",
"dockerComposeFile": "docker-compose.yml",
"service": "bde_isima",
"workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create.
"settings": {
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.trimTrailingWhitespace": true
"customizations": {
"vscode": {
"settings": {
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.trimTrailingWhitespace": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"mikestead.dotenv",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"graphql.vscode-graphql",
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode",
"mgmcdermott.vscode-language-babel",
"prisma.prisma",
"shardulm94.trailing-spaces",
"bradlc.vscode-tailwindcss"
]
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"mikestead.dotenv",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"graphql.vscode-graphql",
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode",
"mgmcdermott.vscode-language-babel",
"prisma.prisma",
"shardulm94.trailing-spaces",
"bradlc.vscode-tailwindcss"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
3000
Expand Down
7 changes: 1 addition & 6 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ DATABASE_URL=postgresql://postgres:postgres@bde_isima_pg:5432/postgres

NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_GA_TRACKING_ID=REDACTED
NEXT_PUBLIC_DISCORD_SERVER_URL=https://discord.gg/bnJ3narzF3

LYF_API_VENDOR_ID=deebb957-9025-4894-b52d-24493cdb7278
LYF_API_SECRET_KEY=B52DFC6C7F4AA054CDB08E38B2298C97A4A12039
LYF_CREDIT_CARD_API_URL=https://sandbox-webpos.lyf.eu/fr/plugin/PaymentCb.aspx
LYF_FROM_APPLICATION_API_URL=https://sandbox-webpos.lyf.eu/fr/plugin/Payment.aspx
NEXT_PUBLIC_DISCORD_SERVER_URL=REDACTED

SESSION_SECRET_KEY=generate_on_https://randomkeygen.com

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ jobs:
envkey_CONTACT_MAIL: ${{ secrets.CONTACT_MAIL }}
envkey_DATABASE_URL: ${{ secrets.DATABASE_URL }}
envkey_SESSION_SECRET_KEY: ${{ secrets.SESSION_SECRET_KEY }}
envkey_LYF_API_VENDOR_ID: ${{ secrets.LYF_API_VENDOR_ID }}
envkey_LYF_API_SECRET_KEY: ${{ secrets.LYF_API_SECRET_KEY }}
envkey_LYF_FROM_APPLICATION_API_URL: ${{ secrets.LYF_FROM_APPLICATION_API_URL }}
envkey_LYF_CREDIT_CARD_API_URL: ${{ secrets.LYF_CREDIT_CARD_API_URL }}
envkey_NEXT_PUBLIC_FRONTEND_URL: ${{ secrets.NEXT_PUBLIC_FRONTEND_URL }}
envkey_NEXT_PUBLIC_GA_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GA_TRACKING_ID }}
envkey_NEXT_PUBLIC_DISCORD_SERVER_URL: ${{ secrets.NEXT_PUBLIC_DISCORD_SERVER_URL }}
envkey_SMTP_EMAIL: bde.isima.webmaster@gmail.com
envkey_SMTP_USER: bde.isima.webmaster
envkey_SMTP_HOST: ${{ secrets.SMTP_HOST }}
Expand Down
5 changes: 5 additions & 0 deletions app/blitz-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import db from 'db';

import { AuthServerPlugin, PrismaStorage, simpleRolesIsAuthorized } from '@blitzjs/auth';
import { setupBlitzServer } from '@blitzjs/next';
import { BlitzLogger } from 'blitz';

import { authConfig } from 'app/blitz-client';

export const { gSSP, gSP, api } = setupBlitzServer({
logger: BlitzLogger({
minLevel: 'warn',
colorizePrettyLogs: true,
}),
plugins: [
AuthServerPlugin({
...authConfig,
Expand Down
5 changes: 5 additions & 0 deletions app/components/dashboard/cashing/CashingDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { isTroll } from 'app/core/utils/listeux_or_troll';
import getTransactions from 'app/entities/transactions/queries/getTransactions';
import getUser from 'app/entities/users/queries/getUser';
import getUsers from 'app/entities/users/queries/getUsers';
import Adherent from 'app/components/hub/transactions/display/Adherent';

const Catalog = lazy(() => import('./catalog/Catalog'));
const AdminTransfer = lazy(() => import('./adminTransfer/AdminTransfer'));
Expand Down Expand Up @@ -99,6 +100,10 @@ export default function CashingDialog({ user, onSelection, onClear }) {
</IconButton>
</DialogActions>

<Suspense fallback={<Skeleton width="50%" height={55} />}>
<Adherent getQuery={getUser} queryArgs={{ where: { id: user?.id } }} />
</Suspense>

<DialogContent className="p-0 text-center">
<Suspense fallback={<Skeleton width="60%" height={55} />}>
<Balance getQuery={getUser} queryArgs={{ where: { id: user?.id } }} variant="h6" />
Expand Down
7 changes: 5 additions & 2 deletions app/components/dashboard/clubs/ClubForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Divider from '@mui/material/Divider';
import IconButton from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment';
import { Club } from 'db';
import { TextField } from 'mui-rff';
import { Switches, TextField } from 'mui-rff';

import OpenInNew from '@mui/icons-material/OpenInNewTwoTone';

Expand Down Expand Up @@ -43,7 +43,8 @@ export default function ClubForm(props: ClubFormProps) {
facebookURL: props.initialValues?.facebookURL,
twitterURL: props.initialValues?.twitterURL,
instagramURL: props.initialValues?.instagramURL,
customURL: props.initialValues?.customURL
customURL: props.initialValues?.customURL,
isPublic: props.initialValues?.isPublic
}}
onSubmit={onSubmit}
autoComplete="off"
Expand Down Expand Up @@ -84,6 +85,8 @@ export default function ClubForm(props: ClubFormProps) {
<TextField type="email" name="email" label="Adresse email" />
<TextField type="text" name="description" label="Description" multiline rows={15} />

<Switches name="isPublic" data={{ label: 'Public', value: 'isPublic' }} color="primary" />

<Divider className="m-2" />

<TextField type="text" name="facebookURL" label="Facebook" />
Expand Down
7 changes: 5 additions & 2 deletions app/components/dashboard/partners/PartnerForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import IconButton from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment';
import { Partner } from 'db';
import { TextField } from 'mui-rff';
import { Switches, TextField } from 'mui-rff';

import OpenInNew from '@mui/icons-material/OpenInNewTwoTone';

Expand Down Expand Up @@ -37,7 +37,8 @@ export default function PartnerForm(props: PartnerFormProps) {
id: props.initialValues?.id,
image: props.initialValues?.image,
name: props.initialValues?.name,
description: props.initialValues?.description
description: props.initialValues?.description,
isPublic: props.initialValues?.isPublic
}}
onSubmit={onSubmit}
autoComplete="off"
Expand Down Expand Up @@ -76,6 +77,8 @@ export default function PartnerForm(props: PartnerFormProps) {

<TextField type="text" name="name" label="Nom" />
<TextField type="text" name="description" label="Description" multiline rows={10} />

<Switches name="isPublic" data={{ label: 'Public', value: 'isPublic' }} color="primary" />
</Form>
);
}
6 changes: 4 additions & 2 deletions app/components/forms/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const ClubInput = z
facebookURL: z.string().url().optional().nullable(),
twitterURL: z.string().url().optional().nullable(),
instagramURL: z.string().url().optional().nullable(),
customURL: z.string().url().optional().nullable()
customURL: z.string().url().optional().nullable(),
isPublic: z.boolean().optional().nullable()
})
.partial();
export type ClubInputType = z.infer<typeof ClubInput>;
Expand Down Expand Up @@ -113,7 +114,8 @@ export const PartnerInput = z
.optional()
.nullable(),
name: z.string().max(255),
description: z.string().max(3000).optional().nullable()
description: z.string().max(3000).optional().nullable(),
isPublic: z.boolean().optional().nullable()
})
.partial();
export type PartnerInputType = z.infer<typeof PartnerInput>;
Expand Down
20 changes: 20 additions & 0 deletions app/components/hub/transactions/display/Adherent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Typography, { TypographyTypeMap } from '@mui/material/Typography';

import { useQuery } from '@blitzjs/rpc';

type BalanceProps = {
getQuery: any;
queryArgs?: any;
variant?: TypographyTypeMap['props']['variant'];
};

export default function Adherent({ getQuery, queryArgs = {}, variant = 'h5' }: BalanceProps) {
const [user] = useQuery(getQuery, queryArgs);
const adherent = (user as any).is_member;

return (
<Typography color={adherent ? 'success.main' : 'error.main'} variant={variant} align="center">
{adherent ? 'Cotisant' : 'Non-Cotisant'}
</Typography>
);
}
16 changes: 1 addition & 15 deletions app/components/hub/transactions/display/TransactionsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Suspense } from 'react';

import Badge from '@mui/material/Badge';
import Button from '@mui/material/Button';
import ButtonGroup from '@mui/material/ButtonGroup';
import Card from '@mui/material/Card';
Expand All @@ -9,15 +8,14 @@ import Typography from '@mui/material/Typography';

import CompareArrows from '@mui/icons-material/CompareArrowsTwoTone';
import History from '@mui/icons-material/HistoryTwoTone';
import LocalAtm from '@mui/icons-material/LocalAtmTwoTone';

import { useAuthenticatedSession } from '@blitzjs/auth';

import Balance from 'app/components/hub/transactions/display/Balance';
import RecentTransactions from 'app/components/hub/transactions/display/RecentTransactions';
import getCurrentUser from 'app/entities/users/queries/getCurrentUser';

export default function TransactionsCard({ openTransfer, openHistory, openTopUp }) {
export default function TransactionsCard({ openTransfer, openHistory }) {
const session = useAuthenticatedSession();

const FallbackComponent = [...Array(10).keys()].map((x) => (
Expand Down Expand Up @@ -53,18 +51,6 @@ export default function TransactionsCard({ openTransfer, openHistory, openTopUp
Historique
</Button>
</ButtonGroup>

<Badge>
<Button
variant="outlined"
startIcon={<LocalAtm />}
aria-label="Recharger"
onClick={openTopUp}
color="inherit"
>
Recharger
</Button>
</Badge>
</div>
</Card>
);
Expand Down
41 changes: 0 additions & 41 deletions app/components/hub/transactions/operations/topUp/TopUp.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions app/components/hub/transactions/operations/topUp/TopUpDialog.tsx

This file was deleted.

Loading

0 comments on commit 95f7a3f

Please sign in to comment.