Skip to content

Commit

Permalink
chore: merge celluloid staging
Browse files Browse the repository at this point in the history
younes200 committed Dec 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents b7acc90 + c757bf2 commit 89e82a9
Showing 97 changed files with 4,625 additions and 2,839 deletions.
6 changes: 3 additions & 3 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ CI_TEST=true
DATABASE_URL=postgres://postgres:postgres@postgres:5432/celluloid
REDIS_URL=redis://redis

COOKIE_SECRET=cisecret3
COOKIE_DOMAIN=localhost
COOKIE_SECURE=false
BETTER_AUTH_SECRET=cisecret3
BASE_URL=http://localhost:3000



# email params. Check with your SMTP provider
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: Docker Build

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches: [staging]
5 changes: 5 additions & 0 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: E2E Tests

# Add concurrency group to cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches: [staging]
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:20-alpine AS base
RUN apk add --no-cache libc6-compat ffmpeg
RUN apk add --no-cache libc6-compat ffmpeg bash openssl openssl-dev
RUN npm install -g turbo pnpm

FROM base AS pruned
@@ -35,7 +35,7 @@ RUN \

FROM base AS runner
WORKDIR /app
RUN apk add --no-cache ffmpeg curl
RUN apk add --no-cache ffmpeg curl bash openssl openssl-dev

COPY --from=builder /app .

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -47,11 +47,10 @@ The project is organized as a [monorepo](https://blog.scottlogic.com/2018/02/23/
├── apps/ # Main application containers
│ ├── frontend/ # Frontend application code
├── packages/ # Shared packages
│ ├── config/ # Configuration settings and files
│ ├── i18n/ # Internationalization settings and translations
│ ├── passport/ # Passport authentication settings
│ ├── prisma/ # Prisma ORM configurations and schema
│ ├── trpc/ # tRPC settings and utilities
│ ├── auth/ # Authentication settings
│ ├── db/ # Prisma ORM configurations and schema
│ ├── api/ # tRPC settings and utilities
│ ├── types/ # Shared TypeScript types
│ └── utils/ # Shared utilities
├── tests/ # Test scripts and test-related utilities
46 changes: 0 additions & 46 deletions apps/frontend/jsconfig.json

This file was deleted.

22 changes: 11 additions & 11 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
@@ -14,17 +14,17 @@
"type": "module",
"private": true,
"scripts": {
"dev": "pnpm with-env tsx src/server/main.ts",
"dev": "tsx src/server/main.ts",
"start": "NODE_ENV=production tsx src/server/main.ts",
"build": "vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@adminjs/express": "^6.1.0",
"@adminjs/express": "^6.1.1",
"@adminjs/prisma": "^5.0.3",
"@adminjs/themes": "^1.0.1",
"@celluloid/passport": "workspace:*",
"@celluloid/auth": "workspace:*",
"@celluloid/prisma": "workspace:*",
"@celluloid/queue": "workspace:*",
"@celluloid/react-player": "2.14.0",
@@ -34,11 +34,13 @@
"@cutting/use-get-parent-size": "^2.1.4",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@godaddy/terminus": "^4.12.1",
"@mui": "link:@mui",
"@mui/icons-material": "^6.1.2",
"@mui/lab": "^5.0.0-alpha.153",
"@mui/material": "^6.1.2",
"@mui/styles": "^6.1.2",
"@t3-oss/env-core": "^0.11.1",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^5.4.2",
"@tiptap/extension-text-style": "^2.9.1",
@@ -48,6 +50,7 @@
"@types/linkify-urls": "^3.1.1",
"@uidotdev/usehooks": "^2.4.1",
"adminjs": "^7.8.13",
"better-auth": "^1.0.21",
"change-case": "^4.1.2",
"cookie-parser": "^1.4.7",
"copy-to-clipboard": "^3.3.3",
@@ -56,7 +59,6 @@
"enzyme": "^3.3.0",
"express": "^4.21.1",
"express-formidable": "^1.2.0",
"express-session": "^1.18.1",
"file-saver": "^2.0.5",
"formik": "^2.2.9",
"get-urls": "^11.0.0",
@@ -69,13 +71,11 @@
"moment-duration-format": "^2.2.2",
"mui-image": "^1.0.7",
"notistack": "^3.0.1",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"query-string": "^6.1.0",
"ramda": "^0.28.0",
"randomcolor": "^0.5.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "catalog:react18",
"react-dom": "catalog:react18",
"react-draggable": "^4.4.6",
"react-error-boundary": "^4.0.11",
"react-i18next": "^13.2.2",
@@ -90,7 +90,7 @@
"serve": "^14.2.1",
"shiitake": "^3.0.2",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"typescript": "catalog:",
"vite-express": "^0.19.0",
"xml2js": "^0.6.2",
"yup": "^1.4.0",
@@ -117,7 +117,6 @@
"@types/cors": "^2.8.13",
"@types/express": "^4",
"@types/express-formidable": "^1",
"@types/express-session": "^1",
"@types/file-saver": "^2.0.5",
"@types/get-urls": "^9.1.3",
"@types/i18next": "^13.0.0",
@@ -141,7 +140,8 @@
"eslint": "^8.50.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.5",
"typescript": "^5.6.2",
"nodemon": "^3.1.9",
"typescript": "catalog:",
"vite": "^4.5.5",
"vite-aliases": "^0.11.7"
}
Binary file added apps/frontend/public/celluloid-email-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 30 additions & 26 deletions apps/frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "dayjs/locale/fr"; // import locale

import { CssBaseline, Dialog, ThemeProvider } from "@mui/material";
import { CssBaseline, ThemeProvider } from "@mui/material";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { createWSClient, httpBatchLink, splitLink, wsLink } from "@trpc/client";
@@ -16,7 +16,6 @@ import React, { Suspense, useCallback, useState } from "react";
import { initReactI18next } from "react-i18next";
import {
BrowserRouter,
createBrowserRouter,
Navigate,
Route,
Routes,
@@ -55,10 +54,6 @@ import { createTheme } from "./theme";

const API_URL = "/api/trpc";

const WS_URL = `${location.protocol === "https:" ? "wss" : "ws"}://${
location.host
}/trpc`;

dayjs.extend(relativeTime);
dayjs.extend(isLeapYear); // use plugin
dayjs.extend(duration);
@@ -166,28 +161,37 @@ const App = () => {
const [trpcClient] = useState(() =>
trpc.createClient({
links: [
splitLink({
condition(op) {
// check for operation type
return op.type === "subscription";
httpBatchLink({
url: "/api/trpc",
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
// when condition is true, use normal request
true: wsLink({
client: createWSClient({
url: WS_URL,
}),
}),
// when condition is false, use batching
false: httpBatchLink({
url: API_URL,
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
}),
}),
// splitLink({
// condition(op) {
// // check for operation type
// return op.type === "subscription";
// },
// // when condition is true, use normal request
// true: wsLink({
// client: createWSClient({
// url: WS_URL,
// }),
// }),
// // when condition is false, use batching
// false: httpBatchLink({
// url: API_URL,
// fetch(url, options) {
// return fetch(url, {
// ...options,
// credentials: "include",
// });
// },
// }),
// }),
],
})
);
18 changes: 7 additions & 11 deletions apps/frontend/src/components/AppBarMenu.tsx
Original file line number Diff line number Diff line change
@@ -9,38 +9,34 @@ import {
} from "@mui/material";
import type * as React from "react";
import { useTranslation } from "react-i18next";
import { useLocation, useNavigate } from "react-router";
import { useNavigate } from "react-router";

import { getButtonLink } from "~components/ButtonLink";
import { Footer } from "~components/Footer";
import { LogoWithLabel } from "~components/LogoWithLabel";
import { SigninMenu } from "~components/SigninMenu";
import { trpc } from "~utils/trpc";

import { LanguageMenu } from "./LanguageMenu";
import { useSession } from "~/lib/auth-client";

const Offset = styled("div")(({ theme }) => theme.mixins.toolbar);

export const AppBarMenu: React.FC<BoxProps> = ({ children }) => {
const { t } = useTranslation();
const navigate = useNavigate();
const { data, isError } = trpc.user.me.useQuery(
{},
{ retry: false, keepPreviousData: false, cacheTime: 0 }
);

const location = useLocation();
const { data: session } = useSession();

const handleCreate = () => {
if (data) {
navigate(`/create`);
if (session) {
navigate("/create");
} else {
navigate("/signup", { state: { backgroundLocation: "/" } });
}
};

const handleJoin = () => {
if (!data) {
if (!session) {
navigate("/signup-student", { state: { backgroundLocation: "/" } });
} else {
navigate("/join", { state: { backgroundLocation: "/" } });
@@ -110,7 +106,7 @@ export const AppBarMenu: React.FC<BoxProps> = ({ children }) => {
{t("menu.about")}
</Button>

<SigninMenu user={!isError ? data : null} />
<SigninMenu user={session?.user} />
<LanguageMenu />
</Toolbar>
</AppBar>
Loading

0 comments on commit 89e82a9

Please sign in to comment.