Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
ceb67bc16c
|
|||
6ae7ec75ef
|
|||
c9045460e9
|
|||
3be7d9cc04
|
|||
5a411ade19
|
|||
41c2d95dde
|
|||
2a6e3eca84
|
|||
84662c7765
|
|||
7e76598f7f | |||
fd138caa4b | |||
fa7b155ea4 | |||
d210800855 | |||
07c574cb4a | |||
ae953d6c1a | |||
c96385edd5 | |||
cd1a477324 |
@ -1,2 +1 @@
|
||||
ARG VARIANT="18"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:20
|
||||
|
@ -3,8 +3,11 @@
|
||||
"dockerComposeFile": "./docker-compose.yml",
|
||||
"service": "workspace",
|
||||
"workspaceFolder": "/workspace",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"remote.autoForwardPorts": false
|
||||
"remote.autoForwardPorts": false,
|
||||
"remote.localPortHost": "allInterfaces"
|
||||
},
|
||||
"extensions": [
|
||||
"editorconfig.editorconfig",
|
||||
@ -14,8 +17,8 @@
|
||||
"mikestead.dotenv",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"ms-azuretools.vscode-docker"
|
||||
],
|
||||
"forwardPorts": [3000],
|
||||
"postAttachCommand": ["npm", "install"],
|
||||
]
|
||||
}
|
||||
},
|
||||
"remoteUser": "node"
|
||||
}
|
||||
|
@ -6,3 +6,4 @@ services:
|
||||
volumes:
|
||||
- '..:/workspace:cached'
|
||||
command: 'sleep infinity'
|
||||
network_mode: 'host'
|
||||
|
@ -1,12 +1,4 @@
|
||||
.vscode
|
||||
.git
|
||||
.env
|
||||
build
|
||||
.next
|
||||
coverage
|
||||
node_modules
|
||||
tmp
|
||||
temp
|
||||
.DS_Store
|
||||
.lighthouseci
|
||||
.vercel
|
||||
|
@ -4,12 +4,14 @@
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"prettier/prettier": "error",
|
||||
"@next/next/no-img-element": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"parser": "@typescript-eslint/parser"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,6 +1,6 @@
|
||||
<!-- Please first discuss the change you wish to make via issue before making a change. It might avoid a waste of your time. -->
|
||||
|
||||
## What changes this PR introduce?
|
||||
# What changes this PR introduce?
|
||||
|
||||
## List any relevant issue numbers
|
||||
|
||||
|
2
.github/workflows/analyze.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
language: ['javascript']
|
||||
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
- uses: 'actions/checkout@v3.5.3'
|
||||
|
||||
- name: 'Initialize CodeQL'
|
||||
uses: 'github/codeql-action/init@v2'
|
||||
|
12
.github/workflows/build.yml
vendored
@ -10,16 +10,16 @@ jobs:
|
||||
build:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
- uses: 'actions/checkout@v3.5.3'
|
||||
|
||||
- name: 'Use Node.js'
|
||||
uses: 'actions/setup-node@v3.5.1'
|
||||
- name: 'Setup Node.js'
|
||||
uses: 'actions/setup-node@v3.6.0'
|
||||
with:
|
||||
node-version: '18.x'
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 'Install'
|
||||
run: 'npm install'
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm clean-install'
|
||||
|
||||
- name: 'Build'
|
||||
run: 'npm run build'
|
||||
|
26
.github/workflows/lint.yml
vendored
@ -10,16 +10,16 @@ jobs:
|
||||
lint:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
- uses: 'actions/checkout@v3.5.3'
|
||||
|
||||
- name: 'Use Node.js'
|
||||
uses: 'actions/setup-node@v3.5.1'
|
||||
- name: 'Setup Node.js'
|
||||
uses: 'actions/setup-node@v3.6.0'
|
||||
with:
|
||||
node-version: '18.x'
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 'Install'
|
||||
run: 'npm install'
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm clean-install'
|
||||
|
||||
- name: 'lint:commit'
|
||||
run: 'npm run lint:commit -- --to "${{ github.sha }}"'
|
||||
@ -30,18 +30,8 @@ jobs:
|
||||
- name: 'lint:markdown'
|
||||
run: 'npm run lint:markdown'
|
||||
|
||||
- name: 'lint:typescript'
|
||||
run: 'npm run lint:typescript'
|
||||
- name: 'lint:eslint'
|
||||
run: 'npm run lint:eslint'
|
||||
|
||||
- name: 'lint:prettier'
|
||||
run: 'npm run lint:prettier'
|
||||
|
||||
- name: 'lint:dotenv'
|
||||
uses: 'dotenv-linter/action-dotenv-linter@v2'
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
|
||||
- name: 'lint:docker'
|
||||
uses: 'hadolint/hadolint-action@v3.0.0'
|
||||
with:
|
||||
dockerfile: './Dockerfile'
|
||||
|
21
.github/workflows/release.yml
vendored
@ -8,26 +8,26 @@ jobs:
|
||||
release:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
- uses: 'actions/checkout@v3.5.3'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: 'Import GPG key'
|
||||
uses: 'crazy-max/ghaction-import-gpg@v4'
|
||||
uses: 'crazy-max/ghaction-import-gpg@v5.3.0'
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
git_user_signingkey: true
|
||||
git_commit_gpgsign: true
|
||||
|
||||
- name: 'Use Node.js'
|
||||
uses: 'actions/setup-node@v3.5.1'
|
||||
- name: 'Setup Node.js'
|
||||
uses: 'actions/setup-node@v3.6.0'
|
||||
with:
|
||||
node-version: '18.x'
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 'Install'
|
||||
run: 'npm install'
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm clean-install'
|
||||
|
||||
- name: 'Release'
|
||||
run: 'npm run release'
|
||||
@ -35,10 +35,3 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
GIT_COMMITTER_NAME: ${{ secrets.GIT_NAME }}
|
||||
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_EMAIL }}
|
||||
|
||||
- name: 'Deploy to Vercel'
|
||||
run: 'npm run deploy -- --token="${VERCEL_TOKEN}" --prod'
|
||||
env:
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
|
48
.github/workflows/test.yml
vendored
@ -10,33 +10,33 @@ jobs:
|
||||
test-unit:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
- uses: 'actions/checkout@v3.5.3'
|
||||
|
||||
- name: 'Use Node.js'
|
||||
uses: 'actions/setup-node@v3.5.1'
|
||||
- name: 'Setup Node.js'
|
||||
uses: 'actions/setup-node@v3.6.0'
|
||||
with:
|
||||
node-version: '18.x'
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 'Install'
|
||||
run: 'npm install'
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm clean-install'
|
||||
|
||||
- name: 'Unit Test'
|
||||
run: 'npm run test:unit'
|
||||
|
||||
test-lighthouse:
|
||||
test-e2e:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
- uses: 'actions/checkout@v3.5.3'
|
||||
|
||||
- name: 'Use Node.js'
|
||||
uses: 'actions/setup-node@v3.5.1'
|
||||
- name: 'Setup Node.js'
|
||||
uses: 'actions/setup-node@v3.6.0'
|
||||
with:
|
||||
node-version: '18.x'
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 'Install'
|
||||
run: 'npm install'
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm clean-install'
|
||||
|
||||
- name: 'Build'
|
||||
run: 'npm run build'
|
||||
@ -44,27 +44,5 @@ jobs:
|
||||
- name: 'html-w3c-validator'
|
||||
run: 'npm run test:html-w3c-validator'
|
||||
|
||||
- name: 'Lighthouse'
|
||||
run: 'npm run test:lighthouse'
|
||||
env:
|
||||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
||||
|
||||
test-e2e:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3.1.0'
|
||||
|
||||
- name: 'Use Node.js'
|
||||
uses: 'actions/setup-node@v3.5.1'
|
||||
with:
|
||||
node-version: '18.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 'Install'
|
||||
run: 'npm install'
|
||||
|
||||
- name: 'Build'
|
||||
run: 'npm run build'
|
||||
|
||||
- name: 'End To End (e2e) Test'
|
||||
run: 'npm run test:e2e'
|
||||
|
6
.gitignore
vendored
@ -18,10 +18,6 @@ cypress/screenshots
|
||||
cypress/videos
|
||||
cypress/downloads
|
||||
|
||||
# PWA
|
||||
**/workbox-*.js
|
||||
**/sw.js
|
||||
|
||||
# envs
|
||||
.env
|
||||
.env.production
|
||||
@ -47,8 +43,6 @@ npm-debug.log*
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.lighthouseci
|
||||
.vercel
|
||||
*.hbs
|
||||
|
||||
# typescript
|
||||
|
@ -1,31 +0,0 @@
|
||||
{
|
||||
"ci": {
|
||||
"collect": {
|
||||
"startServerCommand": "npm run start",
|
||||
"startServerReadyPattern": "ready on",
|
||||
"startServerReadyTimeout": 20000,
|
||||
"url": [
|
||||
"http://127.0.0.1:3000/",
|
||||
"http://127.0.0.1:3000/authentication/forgot-password",
|
||||
"http://127.0.0.1:3000/authentication/reset-password",
|
||||
"http://127.0.0.1:3000/authentication/signin",
|
||||
"http://127.0.0.1:3000/authentication/signup"
|
||||
],
|
||||
"numberOfRuns": 1
|
||||
},
|
||||
"assert": {
|
||||
"preset": "lighthouse:recommended",
|
||||
"assertions": {
|
||||
"image-size-responsive": "warning",
|
||||
"unsized-images": "warning",
|
||||
"csp-xss": "warning",
|
||||
"non-composited-animations": "warning",
|
||||
"unused-javascript": "warning"
|
||||
}
|
||||
},
|
||||
"upload": {
|
||||
"target": "temporary-public-storage"
|
||||
},
|
||||
"server": {}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"config": {
|
||||
"extends": "markdownlint/style/prettier",
|
||||
"relative-links": true,
|
||||
"default": true,
|
||||
"MD013": false,
|
||||
"MD024": false,
|
||||
"MD033": false,
|
||||
"MD041": false
|
||||
"MD033": false
|
||||
},
|
||||
"globs": ["**/*.{md,mdx}"],
|
||||
"ignores": ["**/node_modules"]
|
||||
"ignores": ["**/node_modules"],
|
||||
"customRules": ["markdownlint-rule-relative-links"]
|
||||
}
|
||||
|
6
.vscode/settings.json
vendored
@ -6,5 +6,9 @@
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true
|
||||
}
|
||||
},
|
||||
"eslint.options": {
|
||||
"ignorePath": ".gitignore"
|
||||
},
|
||||
"prettier.ignorePath": ".gitignore"
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ representative at an online or offline event.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
contact@divlo.fr.
|
||||
<contact@theoludwig.fr>.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
|
@ -30,31 +30,7 @@ If you're adding new features to **Thream/website**, please include tests.
|
||||
|
||||
## Commits
|
||||
|
||||
The commit message guidelines respect
|
||||
[@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional)
|
||||
and [Semantic Versioning](https://semver.org/) for releases.
|
||||
|
||||
### Types
|
||||
|
||||
Types define which kind of changes you made to the project.
|
||||
|
||||
| Types | Description |
|
||||
| -------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| feat | A new feature. |
|
||||
| fix | A bug fix. |
|
||||
| docs | Documentation only changes. |
|
||||
| style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). |
|
||||
| refactor | A code change that neither fixes a bug nor adds a feature. |
|
||||
| perf | A code change that improves performance. |
|
||||
| test | Adding missing tests or correcting existing tests. |
|
||||
| build | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm). |
|
||||
| ci | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs). |
|
||||
| chore | Other changes that don't modify src or test files. |
|
||||
| revert | Reverts a previous commit. |
|
||||
|
||||
### Scopes
|
||||
|
||||
Scopes define what part of the code changed.
|
||||
The commit message guidelines adheres to [Conventional Commits](https://www.conventionalcommits.org/) and [Semantic Versioning](https://semver.org/) for releases.
|
||||
|
||||
### Examples
|
||||
|
||||
@ -67,10 +43,10 @@ git commit -m "docs(readme): update installation process"
|
||||
|
||||
[Reference issue](https://github.com/Thream/website/issues/24)
|
||||
|
||||
Feel free to contribute to Thream and add new languages, we would appreciate your help!
|
||||
Feel free to contribute to **Thream** and add new languages, we would appreciate your help!
|
||||
|
||||
To add a new language:
|
||||
|
||||
- `npm install`
|
||||
- `npm clean-install`
|
||||
- `npm run generate`
|
||||
- Start editing JSON files with the translation in `locales/{{locale}}` (e.g: `locales/en`)
|
||||
|
29
Dockerfile
@ -1,21 +1,22 @@
|
||||
FROM node:18.12.1 AS dependencies
|
||||
WORKDIR /usr/src/app
|
||||
FROM node:20.5.0 AS builder-dependencies
|
||||
WORKDIR /usr/src/application
|
||||
COPY ./.npmrc ./
|
||||
COPY ./package*.json ./
|
||||
RUN npm install
|
||||
RUN npm clean-install
|
||||
|
||||
FROM node:18.12.1 AS builder
|
||||
WORKDIR /usr/src/app
|
||||
FROM node:20.5.0 AS builder
|
||||
WORKDIR /usr/src/application
|
||||
COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules
|
||||
COPY ./ ./
|
||||
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
|
||||
RUN npm run build
|
||||
|
||||
FROM node:18.12.1 AS runner
|
||||
WORKDIR /usr/src/app
|
||||
FROM gcr.io/distroless/nodejs20-debian11:latest AS runner
|
||||
WORKDIR /usr/src/application
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=builder /usr/src/app/.next/standalone ./
|
||||
COPY --from=builder /usr/src/app/.next/static ./.next/static
|
||||
COPY --from=builder /usr/src/app/public ./public
|
||||
COPY --from=builder /usr/src/app/locales ./locales
|
||||
COPY --from=builder /usr/src/app/next.config.js ./next.config.js
|
||||
CMD ["node", "server.js"]
|
||||
COPY --from=builder /usr/src/application/.next/standalone ./
|
||||
COPY --from=builder /usr/src/application/.next/static ./.next/static
|
||||
COPY --from=builder /usr/src/application/public ./public
|
||||
COPY --from=builder /usr/src/application/locales ./locales
|
||||
COPY --from=builder /usr/src/application/next.config.js ./next.config.js
|
||||
CMD ["./server.js"]
|
||||
|
10
README.md
@ -1,4 +1,4 @@
|
||||
<h1 align="center"><a href="https://thream.divlo.fr/">Thream/website</a></h1>
|
||||
<h1 align="center"><a href="https://thream.theoludwig.fr/">Thream/website</a></h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="./CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" /></a>
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
Thream's website to stay close with your friends and communities.
|
||||
|
||||
It uses [Thream/api](https://github.com/Thream/api) [v1.2.3](https://github.com/Thream/api/releases/tag/v1.2.3).
|
||||
It uses [Thream/api](https://github.com/Thream/api) [v1.2.8](https://github.com/Thream/api/releases/tag/v1.2.8).
|
||||
|
||||
## ⚙️ Getting Started
|
||||
|
||||
@ -31,7 +31,7 @@ It uses [Thream/api](https://github.com/Thream/api) [v1.2.3](https://github.com/
|
||||
|
||||
```sh
|
||||
# Clone the repository
|
||||
git clone https://github.com/Thream/website.git
|
||||
git clone git@github.com:Thream/website.git
|
||||
|
||||
# Go to the project root
|
||||
cd website
|
||||
@ -40,7 +40,7 @@ cd website
|
||||
cp .env.example .env
|
||||
|
||||
# Install
|
||||
npm install
|
||||
npm clean-install
|
||||
```
|
||||
|
||||
You will need to configure the environment variables by creating an `.env` file at
|
||||
@ -61,7 +61,7 @@ docker compose up --build
|
||||
|
||||
#### Services started
|
||||
|
||||
- website : `http://127.0.0.1:3000`
|
||||
- `website`: <http://127.0.0.1:3000>
|
||||
|
||||
## 💡 Contributing
|
||||
|
||||
|
@ -185,7 +185,7 @@ export const Application: React.FC<
|
||||
visible={visibleSidebars.left}
|
||||
isMobile={isMobile}
|
||||
>
|
||||
<div className='top-0 left-0 z-50 flex min-w-[92px] flex-col space-y-4 border-r-2 border-gray-500 bg-gray-200 py-2 dark:border-white/20 dark:bg-gray-800'>
|
||||
<div className='left-0 top-0 z-50 flex min-w-[92px] flex-col space-y-4 border-r-2 border-gray-500 bg-gray-200 py-2 dark:border-white/20 dark:bg-gray-800'>
|
||||
<IconLink
|
||||
href={`/application/users/settings`}
|
||||
selected={path === `/application/users/settings`}
|
||||
|
@ -64,7 +64,7 @@ export const ChannelSettings: React.FC<ChannelSettingsProps> = (props) => {
|
||||
} catch (error) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ const ChannelMemo: React.FC<ChannelProps> = (props) => {
|
||||
<Link
|
||||
href={`/application/${path.guildId}/${channel.id}`}
|
||||
className={classNames(
|
||||
'group relative my-3 mx-3 flex items-center justify-between overflow-hidden rounded-lg py-2 text-sm transition-all duration-200 hover:bg-gray-100 dark:hover:bg-gray-600',
|
||||
'group relative mx-3 my-3 flex items-center justify-between overflow-hidden rounded-lg py-2 text-sm transition-all duration-200 hover:bg-gray-100 dark:hover:bg-gray-600',
|
||||
{
|
||||
'font-semibold text-green-800 dark:text-green-400': selected
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export const ConfirmPopup: React.FC<ConfirmPopupProps> = ({ ...props }) => {
|
||||
<div className={props.className}>
|
||||
<Loader
|
||||
className={classNames(
|
||||
'absolute top-1/2 left-1/2 scale-0 transition-all',
|
||||
'absolute left-1/2 top-1/2 scale-0 transition-all',
|
||||
{
|
||||
'scale-100': isLoading
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export const CreateChannel: React.FC = () => {
|
||||
} catch (error) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,13 +35,17 @@ export const CreateGuild: React.FC = () => {
|
||||
AxiosResponse<{ guild: GuildComplete }>
|
||||
>('/guilds', { name: formData.name, description: formData.description })
|
||||
const guildId = data.guild.id
|
||||
const channelId = data.guild.channels[0].id
|
||||
const channel = data.guild.channels[0]
|
||||
if (channel == null) {
|
||||
throw new Error('No channel found')
|
||||
}
|
||||
const channelId = channel.id
|
||||
await router.push(`/application/${guildId}/${channelId}`)
|
||||
return null
|
||||
} catch (error) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,12 +56,12 @@ export const GuildSettings: React.FC = () => {
|
||||
setInputValues(formData as unknown as any)
|
||||
return {
|
||||
type: 'success',
|
||||
value: 'application:saved-information'
|
||||
message: 'application:saved-information'
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,12 +82,16 @@ export const GuildSettings: React.FC = () => {
|
||||
) => {
|
||||
setFetchState('loading')
|
||||
const files = event?.target?.files
|
||||
if (files != null && files.length === 1) {
|
||||
if (files != null && files.length === 1 && files[0] != null) {
|
||||
const file = files[0]
|
||||
const formData = new FormData()
|
||||
formData.append('icon', file)
|
||||
try {
|
||||
await authentication.api.put(`/guilds/${guild.id}/icon`, formData)
|
||||
await authentication.api.put(`/guilds/${guild.id}/icon`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
setFetchState('idle')
|
||||
} catch (error) {
|
||||
setFetchState('error')
|
||||
|
@ -96,7 +96,7 @@ export const GuildPublic: React.FC<GuildPublicProps> = (props) => {
|
||||
<ConfirmPopup
|
||||
title={`${t('application:join-the-guild')} ?`}
|
||||
className={classNames(
|
||||
'w-ful h-ful translate-x- absolute top-1/2 left-full flex h-full w-full -translate-y-1/2 flex-col items-center justify-center rounded-2xl transition-all',
|
||||
'w-ful h-ful translate-x- absolute left-full top-1/2 flex h-full w-full -translate-y-1/2 flex-col items-center justify-center rounded-2xl transition-all',
|
||||
{
|
||||
'!left-0': isConfirmed
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ export const JoinGuildsPublic: React.FC = () => {
|
||||
<input
|
||||
data-cy='search-guild-input'
|
||||
onChange={handleChange}
|
||||
className='my-6 mx-auto mt-16 w-10/12 rounded-md border border-gray-500 bg-white p-3 dark:border-gray-700 dark:bg-[#3B3B3B] sm:w-8/12 md:w-6/12 lg:w-5/12'
|
||||
className='mx-auto my-6 mt-16 w-10/12 rounded-md border border-gray-500 bg-white p-3 dark:border-gray-700 dark:bg-[#3B3B3B] sm:w-8/12 md:w-6/12 lg:w-5/12'
|
||||
type='search'
|
||||
name='search-guild'
|
||||
placeholder={`🔎 ${t('application:search')}...`}
|
||||
|
@ -14,7 +14,7 @@ const MemberMemo: React.FC<MemberProps> = (props) => {
|
||||
|
||||
return (
|
||||
<Link href={`/application/users/${member.user.id}`}>
|
||||
<div className='flex cursor-pointer items-center overflow-hidden py-2 px-6 pr-10 hover:bg-gray-300 dark:hover:bg-gray-900'>
|
||||
<div className='flex cursor-pointer items-center overflow-hidden px-6 py-2 pr-10 hover:bg-gray-300 dark:hover:bg-gray-900'>
|
||||
<div className='flex min-w-[50px] rounded-full'>
|
||||
<Image
|
||||
src={
|
||||
|
@ -22,7 +22,7 @@ export const MessageOptions: React.FC<
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='absolute right-6 -top-8 flex opacity-0 transition-opacity group-hover:opacity-100'>
|
||||
<div className='absolute -top-8 right-6 flex opacity-0 transition-opacity group-hover:opacity-100'>
|
||||
{message.type === 'text' && (
|
||||
<div
|
||||
className='message-options rounded-l-lg border-l-slate-600'
|
||||
|
@ -50,7 +50,8 @@ export const MessageText: React.FC<MessageContentProps> = (props) => {
|
||||
)
|
||||
},
|
||||
emoji: (props) => {
|
||||
return <Emoji value={props.value} size={20} tooltip />
|
||||
const { value } = props
|
||||
return <Emoji value={value} size={20} tooltip />
|
||||
},
|
||||
code: (properties) => {
|
||||
const { inline, className, children, ...props } = properties
|
||||
|
@ -54,13 +54,18 @@ export const SendMessage: React.FC<SendMessageProps> = (props) => {
|
||||
event
|
||||
) => {
|
||||
const files = event?.target?.files
|
||||
if (files != null && files.length === 1) {
|
||||
if (files != null && files.length === 1 && files[0] != null) {
|
||||
const file = files[0]
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
await authentication.api.post(
|
||||
`/channels/${path.channelId}/messages/uploads`,
|
||||
formData
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ export const Sidebar: React.FC<React.PropsWithChildren<SidebarProps>> = (
|
||||
className={classNames(
|
||||
'h-full-without-header visible z-50 flex bg-gray-200 drop-shadow-2xl transition-all dark:bg-gray-800',
|
||||
{
|
||||
'scrollbar-firefox-support top-0 right-0 flex-col space-y-1 overflow-y-auto':
|
||||
'scrollbar-firefox-support right-0 top-0 flex-col space-y-1 overflow-y-auto':
|
||||
direction === 'right',
|
||||
'w-72': direction === 'right' && visible,
|
||||
'invisible w-0 opacity-0': !visible,
|
||||
'w-80': direction === 'left' && visible,
|
||||
'max-w-max': typeof path !== 'string' && direction === 'left',
|
||||
'top-0 right-0': direction === 'right' && isMobile,
|
||||
'right-0 top-0': direction === 'right' && isMobile,
|
||||
absolute: isMobile
|
||||
}
|
||||
)}
|
||||
|
@ -58,7 +58,7 @@ export const UserProfile: React.FC<UserProfileProps> = (props) => {
|
||||
<a
|
||||
href={`mailto:${user.email}`}
|
||||
target='_blank'
|
||||
className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:left-0 after:bottom-[-1px] after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white'
|
||||
className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:bottom-[-1px] after:left-0 after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white'
|
||||
rel='noreferrer'
|
||||
data-cy='user-email'
|
||||
>
|
||||
@ -73,7 +73,7 @@ export const UserProfile: React.FC<UserProfileProps> = (props) => {
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
href={user.website}
|
||||
className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:left-0 after:bottom-[-2px] after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white'
|
||||
className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:bottom-[-2px] after:left-0 after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white'
|
||||
>
|
||||
{user.website}
|
||||
</a>
|
||||
|
@ -75,7 +75,7 @@ export const UserSettings: React.FC = () => {
|
||||
if (hasEmailChanged) {
|
||||
return {
|
||||
type: 'success',
|
||||
value: 'application:success-email-changed'
|
||||
message: 'application:success-email-changed'
|
||||
}
|
||||
}
|
||||
const { data: userCurrentSettings } = await authentication.api.put(
|
||||
@ -94,7 +94,7 @@ export const UserSettings: React.FC = () => {
|
||||
})
|
||||
return {
|
||||
type: 'success',
|
||||
value: 'application:saved-information'
|
||||
message: 'application:saved-information'
|
||||
}
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
||||
@ -102,22 +102,22 @@ export const UserSettings: React.FC = () => {
|
||||
if (message.endsWith('already taken.')) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'authentication:already-used'
|
||||
message: 'authentication:already-used'
|
||||
}
|
||||
} else if (message.endsWith('email to sign in.')) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'authentication:email-required-to-sign-in'
|
||||
message: 'authentication:email-required-to-sign-in'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,14 +149,19 @@ export const UserSettings: React.FC = () => {
|
||||
) => {
|
||||
setFetchState('loading')
|
||||
const files = event?.target?.files
|
||||
if (files != null && files.length === 1) {
|
||||
if (files != null && files.length === 1 && files[0] != null) {
|
||||
const file = files[0]
|
||||
const formData = new FormData()
|
||||
formData.append('logo', file)
|
||||
try {
|
||||
const { data } = await authentication.api.put(
|
||||
`/users/current/logo`,
|
||||
formData
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
)
|
||||
setUser((oldUser) => {
|
||||
return {
|
||||
|
@ -54,7 +54,7 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
|
||||
formElement.reset()
|
||||
return {
|
||||
type: 'success',
|
||||
value: 'authentication:success-signup'
|
||||
message: 'authentication:success-signup'
|
||||
}
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
||||
@ -62,17 +62,17 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
|
||||
if (message.endsWith('already taken.')) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'authentication:already-used'
|
||||
message: 'authentication:already-used'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -86,12 +86,12 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'authentication:wrong-credentials'
|
||||
message: 'authentication:wrong-credentials'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ export const Head: React.FC<HeadProps> = (props) => {
|
||||
|
||||
const {
|
||||
title = 'Thream',
|
||||
image = 'https://thream.divlo.fr/images/icons/128x128.png',
|
||||
image = 'https://thream.theoludwig.fr/images/icon-128x128.png',
|
||||
description = t('common:description'),
|
||||
url = 'https://thream.divlo.fr/'
|
||||
url = 'https://thream.theoludwig.fr/'
|
||||
} = props
|
||||
|
||||
return (
|
||||
@ -26,7 +26,7 @@ export const Head: React.FC<HeadProps> = (props) => {
|
||||
{/* Meta Tag */}
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||
<meta name='description' content={description} />
|
||||
<meta name='Language' content='fr, en' />
|
||||
<meta name='Language' content='fr-FR, en-US' />
|
||||
<meta name='theme-color' content='#27B05E' />
|
||||
|
||||
{/* Open Graph Metadata */}
|
||||
@ -35,7 +35,7 @@ export const Head: React.FC<HeadProps> = (props) => {
|
||||
<meta property='og:url' content={url} />
|
||||
<meta property='og:image' content={image} />
|
||||
<meta property='og:description' content={description} />
|
||||
<meta property='og:locale' content='fr_FR, en_US' />
|
||||
<meta property='og:locale' content='fr-FR, en-US' />
|
||||
<meta property='og:site_name' content={title} />
|
||||
|
||||
{/* Twitter card Metadata */}
|
||||
@ -43,12 +43,6 @@ export const Head: React.FC<HeadProps> = (props) => {
|
||||
<meta name='twitter:description' content={description} />
|
||||
<meta name='twitter:title' content={title} />
|
||||
<meta name='twitter:image' content={image} />
|
||||
|
||||
{/* PWA Data */}
|
||||
<link rel='manifest' href='/manifest.json' />
|
||||
<meta name='apple-mobile-web-app-capable' content='yes' />
|
||||
<meta name='mobile-web-app-capable' content='yes' />
|
||||
<link rel='apple-touch-icon' href={image} />
|
||||
</NextHead>
|
||||
)
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ export const Header: React.FC = () => {
|
||||
quality={100}
|
||||
width={60}
|
||||
height={60}
|
||||
src='/images/icons/Thream.png'
|
||||
src='/images/Thream.png'
|
||||
alt='Thream'
|
||||
/>
|
||||
<span className='ml-1 hidden font-headline font-medium text-green-800 dark:text-green-400 xs:block'>
|
||||
|
@ -29,7 +29,7 @@ export const SwitchTheme: React.FC = () => {
|
||||
<div
|
||||
data-cy='switch-theme-dark'
|
||||
className={classNames(
|
||||
'absolute top-0 bottom-0 left-[8px] mt-auto mb-auto h-[10px] w-[14px] leading-[0] transition-opacity duration-[250ms] ease-in-out',
|
||||
'absolute bottom-0 left-[8px] top-0 mb-auto mt-auto h-[10px] w-[14px] leading-[0] transition-opacity duration-[250ms] ease-in-out',
|
||||
{
|
||||
'opacity-100': theme === 'dark',
|
||||
'opacity-0': theme === 'light'
|
||||
@ -43,7 +43,7 @@ export const SwitchTheme: React.FC = () => {
|
||||
<div
|
||||
data-cy='switch-theme-light'
|
||||
className={classNames(
|
||||
'absolute right-[10px] top-0 bottom-0 mt-auto mb-auto h-[10px] w-[10px] leading-[0]',
|
||||
'absolute bottom-0 right-[10px] top-0 mb-auto mt-auto h-[10px] w-[10px] leading-[0]',
|
||||
{
|
||||
'opacity-100': theme === 'light',
|
||||
'opacity-0': theme === 'dark'
|
||||
|
@ -13,7 +13,7 @@ export const Checkbox: React.FC<CheckboxProps> = (props) => {
|
||||
{...props}
|
||||
type='checkbox'
|
||||
id={id}
|
||||
className='relative mr-3 min-h-[25px] min-w-[25px] cursor-pointer appearance-none rounded-md bg-gradient-to-t from-[#bcc7d4] to-[#d3dfed] transition-all before:absolute before:top-[50%] before:left-[59%] before:h-[12px] before:w-[2px] before:translate-x-[-59%] before:translate-y-[-50%] before:rotate-[40deg] before:scale-0 before:bg-black before:transition-all after:absolute after:top-[62.5%] after:left-[36%] after:h-[7px] after:w-[2px] after:translate-x-[-35%] after:translate-y-[-62.5%] after:rotate-[-50deg] after:scale-0 after:bg-black after:transition-all after:duration-200 checked:before:scale-100 checked:after:scale-100 dark:from-[#1f2937] dark:to-[#273547] dark:before:bg-white dark:after:bg-white'
|
||||
className='relative mr-3 min-h-[25px] min-w-[25px] cursor-pointer appearance-none rounded-md bg-gradient-to-t from-[#bcc7d4] to-[#d3dfed] transition-all before:absolute before:left-[59%] before:top-[50%] before:h-[12px] before:w-[2px] before:translate-x-[-59%] before:translate-y-[-50%] before:rotate-[40deg] before:scale-0 before:bg-black before:transition-all after:absolute after:left-[36%] after:top-[62.5%] after:h-[7px] after:w-[2px] after:translate-x-[-35%] after:translate-y-[-62.5%] after:rotate-[-50deg] after:scale-0 after:bg-black after:transition-all after:duration-200 checked:before:scale-100 checked:after:scale-100 dark:from-[#1f2937] dark:to-[#273547] dark:before:bg-white dark:after:bg-white'
|
||||
/>
|
||||
<label
|
||||
className='duration-400 cursor-pointer select-none opacity-80 transition hover:opacity-100 '
|
||||
|
@ -36,7 +36,7 @@ export const Input: React.FC<InputProps> = (props) => {
|
||||
|
||||
return (
|
||||
<div className='flex flex-col'>
|
||||
<div className={classNames('mt-6 mb-2 flex justify-between', className)}>
|
||||
<div className={classNames('mb-2 mt-6 flex justify-between', className)}>
|
||||
<label className='pl-1' htmlFor={name}>
|
||||
{label}
|
||||
</label>
|
||||
@ -66,7 +66,7 @@ export const Input: React.FC<InputProps> = (props) => {
|
||||
style={{
|
||||
backgroundImage: `url('/images/svg/icons/input/${inputType}.svg')`
|
||||
}}
|
||||
className='absolute top-3 right-4 z-10 h-5 w-5 cursor-pointer bg-[#f1f1f1] bg-cover'
|
||||
className='absolute right-4 top-3 z-10 h-5 w-5 cursor-pointer bg-[#f1f1f1] bg-cover'
|
||||
/>
|
||||
)}
|
||||
<FormState
|
||||
|
@ -7,18 +7,18 @@ export interface LoaderProps {
|
||||
}
|
||||
|
||||
export const Loader: React.FC<LoaderProps> = (props) => {
|
||||
const { width = 50, height = 50 } = props
|
||||
const { width = 50, height = 50, className } = props
|
||||
|
||||
return (
|
||||
<div className={props.className}>
|
||||
<div className={className}>
|
||||
<div
|
||||
data-cy='progress-spinner'
|
||||
className='relative my-0 mx-auto before:block before:pt-[100%] before:content-none'
|
||||
className='relative mx-auto my-0 before:block before:pt-[100%] before:content-none'
|
||||
style={{ width: `${width}px`, height: `${height}px` }}
|
||||
>
|
||||
<svg className={styles.progressSpinnerSvg} viewBox='25 25 50 50'>
|
||||
<svg className={styles['progressSpinnerSvg']} viewBox='25 25 50 50'>
|
||||
<circle
|
||||
className={styles.progressSpinnerCircle}
|
||||
className={styles['progressSpinnerCircle']}
|
||||
cx='50'
|
||||
cy='50'
|
||||
r='20'
|
||||
|
@ -58,10 +58,10 @@ export const SocialMediaButton: React.FC<SocialMediaButtonProps> = (props) => {
|
||||
style={{ background: socialMediaColor }}
|
||||
className={classNames(
|
||||
className,
|
||||
styles.button,
|
||||
styles['button'],
|
||||
{
|
||||
[styles.buttonGoogle]: socialMedia === 'Google',
|
||||
[styles.buttonMedia]: socialMedia !== 'Google'
|
||||
[styles['buttonGoogle'] as string]: socialMedia === 'Google',
|
||||
[styles['buttonMedia'] as string]: socialMedia !== 'Google'
|
||||
},
|
||||
givenClassName
|
||||
)}
|
||||
@ -88,10 +88,10 @@ export const SocialMediaLink: React.FC<SocialMediaLinkProps> = (props) => {
|
||||
style={{ background: socialMediaColor }}
|
||||
className={classNames(
|
||||
className,
|
||||
styles.button,
|
||||
styles['button'],
|
||||
{
|
||||
[styles.buttonGoogle]: socialMedia === 'Google',
|
||||
[styles.buttonMedia]: socialMedia !== 'Google'
|
||||
[styles['buttonGoogle'] as string]: socialMedia === 'Google',
|
||||
[styles['buttonMedia'] as string]: socialMedia !== 'Google'
|
||||
},
|
||||
givenClassName
|
||||
)}
|
||||
|
@ -10,7 +10,7 @@ export const Textarea: React.FC<TextareaProps> = (props) => {
|
||||
|
||||
return (
|
||||
<div className='flex flex-col'>
|
||||
<div className='mt-6 mb-2 flex justify-between'>
|
||||
<div className='mb-2 mt-6 flex justify-between'>
|
||||
<label className='pl-1' htmlFor={id}>
|
||||
{label}
|
||||
</label>
|
||||
|
@ -17,9 +17,7 @@ export interface Guilds {
|
||||
const defaultGuildsContext = {} as any
|
||||
const GuildsContext = createContext<Guilds>(defaultGuildsContext)
|
||||
|
||||
export const GuildsProvider: React.FC<React.PropsWithChildren<{}>> = (
|
||||
props
|
||||
) => {
|
||||
export const GuildsProvider: React.FC<React.PropsWithChildren> = (props) => {
|
||||
const { children } = props
|
||||
|
||||
const { authentication } = useAuthentication()
|
||||
|
@ -5,7 +5,7 @@ import { getLocal } from 'mockttp'
|
||||
import type { Mockttp } from 'mockttp'
|
||||
|
||||
import { API_DEFAULT_PORT } from './tools/api'
|
||||
import type { Handlers, Method } from './cypress/fixtures/handler'
|
||||
import type { Handlers } from './cypress/fixtures/handler'
|
||||
|
||||
const UPLOADS_FIXTURES_DIRECTORY = path.join(
|
||||
process.cwd(),
|
||||
@ -26,25 +26,35 @@ export default defineConfig({
|
||||
setupNodeEvents(on, config) {
|
||||
on('task', {
|
||||
async startMockServer(handlers: Handlers): Promise<null> {
|
||||
server = getLocal({
|
||||
cors: true
|
||||
})
|
||||
server = getLocal({ cors: true })
|
||||
await server.start(API_DEFAULT_PORT)
|
||||
for (const handler of handlers) {
|
||||
const { isFile = false } = handler.response
|
||||
const method = handler.method.toLowerCase() as Lowercase<Method>
|
||||
const { isFile = false, statusCode, body } = handler.response
|
||||
let requestBuilder = server.forGet(handler.url)
|
||||
switch (handler.method) {
|
||||
case 'GET':
|
||||
requestBuilder = server.forGet(handler.url)
|
||||
break
|
||||
case 'POST':
|
||||
requestBuilder = server.forPost(handler.url)
|
||||
break
|
||||
case 'PUT':
|
||||
requestBuilder = server.forPut(handler.url)
|
||||
break
|
||||
case 'DELETE':
|
||||
requestBuilder = server.forDelete(handler.url)
|
||||
break
|
||||
}
|
||||
if (isFile) {
|
||||
await server[method](handler.url).thenFromFile(
|
||||
handler.response.statusCode,
|
||||
path.join(UPLOADS_FIXTURES_DIRECTORY, ...handler.response.body)
|
||||
await requestBuilder.thenFromFile(
|
||||
statusCode,
|
||||
path.join(UPLOADS_FIXTURES_DIRECTORY, ...body)
|
||||
)
|
||||
} else {
|
||||
await server[method](handler.url).thenJson(
|
||||
handler.response.statusCode,
|
||||
handler.response.body
|
||||
)
|
||||
await requestBuilder.thenJson(statusCode, body)
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
},
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
@ -2,10 +2,10 @@ services:
|
||||
thream-website:
|
||||
container_name: ${COMPOSE_PROJECT_NAME}
|
||||
image: 'thream-website'
|
||||
restart: 'unless-stopped'
|
||||
build:
|
||||
context: './'
|
||||
ports:
|
||||
- '${PORT-3000}:${PORT-3000}'
|
||||
network_mode: 'host'
|
||||
environment:
|
||||
PORT: ${PORT-3000}
|
||||
env_file: './.env'
|
||||
env_file: '.env'
|
||||
|
@ -13,7 +13,7 @@ const getErrorTranslationKey = (error: Error): string => {
|
||||
return 'errors:required'
|
||||
}
|
||||
if (error.keyword === 'format') {
|
||||
if (error.params.format === 'email') {
|
||||
if (error.params['format'] === 'email') {
|
||||
return 'errors:invalid-email'
|
||||
}
|
||||
return 'errors:invalid'
|
||||
@ -43,7 +43,7 @@ export const useFormTranslation = (): UseFormTranslationResult => {
|
||||
if (error != null) {
|
||||
return t(getErrorTranslationKey(error)).replace(
|
||||
'{expected}',
|
||||
error?.params?.limit
|
||||
error?.params?.['limit']
|
||||
)
|
||||
}
|
||||
return undefined
|
||||
|
@ -57,10 +57,13 @@ export const usePagination = <T extends PaginationItem>(
|
||||
`${url}?${searchParameters.toString()}`
|
||||
)
|
||||
if (!inverse) {
|
||||
const endIndex = newItems.length - 1
|
||||
const lastItem = newItems[endIndex]
|
||||
afterId.current =
|
||||
newItems.length > 0 ? newItems[newItems.length - 1].id : null
|
||||
newItems.length > 0 && lastItem != null ? lastItem.id : null
|
||||
} else {
|
||||
afterId.current = newItems.length > 0 ? newItems[0].id : null
|
||||
afterId.current =
|
||||
newItems.length > 0 && newItems[0] != null ? newItems[0].id : null
|
||||
}
|
||||
setItems((oldItems) => {
|
||||
const updatedItems = inverse
|
||||
@ -110,10 +113,13 @@ export const usePagination = <T extends PaginationItem>(
|
||||
const newItems = getPaginationCache<T>(cacheKey)
|
||||
setItems(newItems)
|
||||
if (!inverse) {
|
||||
const endIndex = newItems.length - 1
|
||||
const lastItem = newItems[endIndex]
|
||||
afterId.current =
|
||||
newItems.length > 0 ? newItems[newItems.length - 1].id : null
|
||||
newItems.length > 0 && lastItem != null ? lastItem.id : null
|
||||
} else {
|
||||
afterId.current = newItems.length > 0 ? newItems[0].id : null
|
||||
afterId.current =
|
||||
newItems.length > 0 && newItems[0] != null ? newItems[0].id : null
|
||||
}
|
||||
fetchState.current = 'idle'
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ export const providersTypebox = providers.map((provider) => {
|
||||
return Type.Literal(provider)
|
||||
})
|
||||
|
||||
export type ProviderOAuth = typeof providers[number]
|
||||
export type AuthenticationStrategy = typeof strategies[number]
|
||||
export type ProviderOAuth = (typeof providers)[number]
|
||||
export type AuthenticationStrategy = (typeof strategies)[number]
|
||||
|
||||
export const oauthSchema = {
|
||||
id,
|
||||
|
@ -1,8 +1,4 @@
|
||||
const nextPWA = require('next-pwa')({
|
||||
disable: process.env.NODE_ENV !== 'production',
|
||||
dest: 'public'
|
||||
})
|
||||
const nextTranslate = require('next-translate')
|
||||
const nextTranslate = require('next-translate-plugin')
|
||||
|
||||
/** @type {import("next").NextConfig} */
|
||||
const nextConfig = {
|
||||
@ -10,11 +6,11 @@ const nextConfig = {
|
||||
output: 'standalone',
|
||||
images: {
|
||||
domains: [
|
||||
'api.thream.divlo.fr',
|
||||
'file-uploads-api.thream.divlo.fr',
|
||||
'api.thream.theoludwig.fr',
|
||||
'file-uploads-api.thream.theoludwig.fr',
|
||||
...(process.env.NODE_ENV !== 'production' ? ['127.0.0.1'] : [])
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = nextTranslate(nextPWA(nextConfig))
|
||||
module.exports = nextTranslate(nextConfig)
|
||||
|
31981
package-lock.json
generated
120
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thream/website",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.8",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -14,98 +14,96 @@
|
||||
"dev": "next dev",
|
||||
"start": "next start",
|
||||
"build": "next build",
|
||||
"export": "next export",
|
||||
"generate": "plop",
|
||||
"lint:commit": "commitlint",
|
||||
"lint:editorconfig": "editorconfig-checker",
|
||||
"lint:markdown": "markdownlint-cli2",
|
||||
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
|
||||
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
|
||||
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives --ignore-path .gitignore",
|
||||
"lint:prettier": "prettier . --check",
|
||||
"lint:staged": "lint-staged",
|
||||
"test:unit": "cypress run --component",
|
||||
"test:html-w3c-validator": "start-server-and-test \"start\" \"http://127.0.0.1:3000\" \"html-w3c-validator\"",
|
||||
"test:lighthouse": "lhci autorun",
|
||||
"test:e2e": "start-server-and-test \"start\" \"http://127.0.0.1:3000\" \"cypress run\"",
|
||||
"test:dev": "start-server-and-test \"dev\" \"http://127.0.0.1:3000\" \"cypress open\"",
|
||||
"release": "semantic-release",
|
||||
"deploy": "vercel",
|
||||
"postinstall": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource/montserrat": "4.5.13",
|
||||
"@fontsource/roboto": "4.5.8",
|
||||
"@fontsource/montserrat": "5.0.5",
|
||||
"@fontsource/roboto": "5.0.5",
|
||||
"@heroicons/react": "1.0.6",
|
||||
"@sinclair/typebox": "0.25.13",
|
||||
"axios": "1.2.1",
|
||||
"clsx": "1.2.1",
|
||||
"date-and-time": "2.4.1",
|
||||
"@sinclair/typebox": "0.29.6",
|
||||
"@thream/socketio-jwt": "3.1.2",
|
||||
"axios": "1.4.0",
|
||||
"clsx": "2.0.0",
|
||||
"date-and-time": "3.0.2",
|
||||
"emoji-mart": "3.0.1",
|
||||
"katex": "0.16.4",
|
||||
"next": "13.0.6",
|
||||
"next-pwa": "5.6.0",
|
||||
"katex": "0.16.8",
|
||||
"next": "13.4.7",
|
||||
"next-themes": "0.2.1",
|
||||
"next-translate": "1.6.0",
|
||||
"pretty-bytes": "6.0.0",
|
||||
"next-translate": "2.4.4",
|
||||
"pretty-bytes": "6.1.1",
|
||||
"react": "18.2.0",
|
||||
"react-component-form": "3.1.1",
|
||||
"react-component-form": "4.1.1",
|
||||
"react-dom": "18.2.0",
|
||||
"react-infinite-scroll-component": "6.1.0",
|
||||
"react-markdown": "8.0.4",
|
||||
"react-markdown": "8.0.7",
|
||||
"react-responsive": "9.0.2",
|
||||
"react-swipeable": "7.0.0",
|
||||
"react-swipeable": "7.0.1",
|
||||
"react-syntax-highlighter": "15.5.0",
|
||||
"react-textarea-autosize": "8.4.0",
|
||||
"read-pkg": "7.1.0",
|
||||
"rehype-katex": "6.0.2",
|
||||
"remark-breaks": "3.0.2",
|
||||
"react-textarea-autosize": "8.5.2",
|
||||
"read-pkg": "8.0.0",
|
||||
"rehype-katex": "6.0.3",
|
||||
"remark-breaks": "3.0.3",
|
||||
"remark-gfm": "3.0.1",
|
||||
"remark-math": "5.1.1",
|
||||
"sharp": "0.31.2",
|
||||
"socket.io-client": "4.5.4",
|
||||
"sharp": "0.32.4",
|
||||
"socket.io-client": "4.7.1",
|
||||
"unified": "10.1.2",
|
||||
"unist-util-visit": "4.1.1",
|
||||
"unist-util-visit": "4.1.2",
|
||||
"universal-cookie": "4.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "17.3.0",
|
||||
"@commitlint/config-conventional": "17.3.0",
|
||||
"@lhci/cli": "0.10.0",
|
||||
"@saithodev/semantic-release-backmerge": "2.1.2",
|
||||
"@commitlint/cli": "17.6.7",
|
||||
"@commitlint/config-conventional": "17.6.7",
|
||||
"@saithodev/semantic-release-backmerge": "3.2.0",
|
||||
"@semantic-release/git": "10.0.1",
|
||||
"@tsconfig/strictest": "2.0.1",
|
||||
"@types/emoji-mart": "3.0.9",
|
||||
"@types/hast": "2.3.4",
|
||||
"@types/katex": "0.14.0",
|
||||
"@types/node": "18.11.14",
|
||||
"@types/react": "18.0.26",
|
||||
"@types/katex": "0.16.1",
|
||||
"@types/node": "20.4.4",
|
||||
"@types/react": "18.2.15",
|
||||
"@types/react-responsive": "8.0.5",
|
||||
"@types/react-syntax-highlighter": "15.5.5",
|
||||
"@types/react-syntax-highlighter": "15.5.7",
|
||||
"@types/unist": "2.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.46.1",
|
||||
"@typescript-eslint/parser": "5.46.1",
|
||||
"autoprefixer": "10.4.13",
|
||||
"cypress": "12.1.0",
|
||||
"editorconfig-checker": "4.0.2",
|
||||
"eslint": "8.29.0",
|
||||
"eslint-config-conventions": "6.0.0",
|
||||
"eslint-config-next": "13.0.6",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"@typescript-eslint/eslint-plugin": "6.1.0",
|
||||
"@typescript-eslint/parser": "6.1.0",
|
||||
"autoprefixer": "10.4.14",
|
||||
"cypress": "12.17.2",
|
||||
"editorconfig-checker": "5.1.1",
|
||||
"eslint": "8.45.0",
|
||||
"eslint-config-conventions": "11.0.1",
|
||||
"eslint-config-next": "13.4.7",
|
||||
"eslint-config-prettier": "8.8.0",
|
||||
"eslint-plugin-import": "2.27.5",
|
||||
"eslint-plugin-prettier": "5.0.0",
|
||||
"eslint-plugin-promise": "6.1.1",
|
||||
"eslint-plugin-unicorn": "45.0.2",
|
||||
"html-w3c-validator": "1.2.1",
|
||||
"husky": "8.0.2",
|
||||
"lint-staged": "13.1.0",
|
||||
"markdownlint-cli2": "0.5.1",
|
||||
"mockttp": "2.7.0",
|
||||
"plop": "3.1.1",
|
||||
"postcss": "8.4.20",
|
||||
"prettier": "2.8.1",
|
||||
"prettier-plugin-tailwindcss": "0.2.1",
|
||||
"semantic-release": "19.0.5",
|
||||
"start-server-and-test": "1.15.2",
|
||||
"tailwindcss": "3.2.4",
|
||||
"typescript": "4.9.4",
|
||||
"vercel": "28.8.0"
|
||||
"eslint-plugin-unicorn": "48.0.0",
|
||||
"html-w3c-validator": "1.4.0",
|
||||
"husky": "8.0.3",
|
||||
"lint-staged": "13.2.3",
|
||||
"markdownlint-cli2": "0.8.1",
|
||||
"markdownlint-rule-relative-links": "2.1.0",
|
||||
"mockttp": "3.9.1",
|
||||
"next-translate-plugin": "2.4.4",
|
||||
"plop": "3.1.2",
|
||||
"postcss": "8.4.27",
|
||||
"prettier": "3.0.0",
|
||||
"prettier-plugin-tailwindcss": "0.4.1",
|
||||
"semantic-release": "21.0.7",
|
||||
"start-server-and-test": "2.0.0",
|
||||
"tailwindcss": "3.3.3",
|
||||
"typescript": "5.1.6"
|
||||
}
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ const ChannelPage: NextPage<ChannelPageProps> = (props) => {
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: true,
|
||||
fetchData: async (context, api) => {
|
||||
const channelId = Number(context?.params?.channelId)
|
||||
const guildId = Number(context?.params?.guildId)
|
||||
if (isNaN(channelId) || isNaN(guildId)) {
|
||||
const channelId = Number(context?.params?.['channelId'])
|
||||
const guildId = Number(context?.params?.['guildId'])
|
||||
if (Number.isNaN(channelId) || Number.isNaN(guildId)) {
|
||||
return {
|
||||
notFound: true
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ const ChannelSettingsPage: NextPage<ChannelSettingsPageProps> = (props) => {
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: true,
|
||||
fetchData: async (context, api) => {
|
||||
const channelId = Number(context?.params?.channelId)
|
||||
const guildId = Number(context?.params?.guildId)
|
||||
if (isNaN(channelId) || isNaN(guildId)) {
|
||||
const channelId = Number(context?.params?.['channelId'])
|
||||
const guildId = Number(context?.params?.['guildId'])
|
||||
if (Number.isNaN(channelId) || Number.isNaN(guildId)) {
|
||||
return {
|
||||
notFound: true
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ const CreateChannelPage: NextPage<CreateChannelPageProps> = (props) => {
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: true,
|
||||
fetchData: async (context, api) => {
|
||||
const guildId = Number(context?.params?.guildId)
|
||||
if (isNaN(guildId)) {
|
||||
const guildId = Number(context?.params?.['guildId'])
|
||||
if (Number.isNaN(guildId)) {
|
||||
return {
|
||||
notFound: true
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ const GuildSettingsPage: NextPage<GuildSettingsPageProps> = (props) => {
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: true,
|
||||
fetchData: async (context, api) => {
|
||||
const guildId = Number(context?.params?.guildId)
|
||||
if (isNaN(guildId)) {
|
||||
const guildId = Number(context?.params?.['guildId'])
|
||||
if (Number.isNaN(guildId)) {
|
||||
return {
|
||||
notFound: true
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ const UserProfilePage: NextPage<UserProfilePageProps> = (props) => {
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: true,
|
||||
fetchData: async (context, api) => {
|
||||
const userId = Number(context?.params?.userId)
|
||||
if (isNaN(userId)) {
|
||||
const userId = Number(context?.params?.['userId'])
|
||||
if (Number.isNaN(userId)) {
|
||||
return {
|
||||
notFound: true
|
||||
}
|
||||
|
@ -42,18 +42,18 @@ const ForgotPassword: NextPage<FooterProps> = (props) => {
|
||||
formElement.reset()
|
||||
return {
|
||||
type: 'success',
|
||||
value: 'authentication:success-forgot-password'
|
||||
message: 'authentication:success-forgot-password'
|
||||
}
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:invalid-email'
|
||||
message: 'errors:invalid-email'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ const ResetPassword: NextPage<FooterProps> = (props) => {
|
||||
try {
|
||||
await api.put(`/users/reset-password`, {
|
||||
...formData,
|
||||
temporaryToken: router.query.temporaryToken
|
||||
temporaryToken: router.query['temporaryToken']
|
||||
})
|
||||
await router.push('/authentication/signin')
|
||||
return null
|
||||
@ -43,12 +43,12 @@ const ResetPassword: NextPage<FooterProps> = (props) => {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:invalid'
|
||||
message: 'errors:invalid'
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'error',
|
||||
value: 'errors:server-error'
|
||||
message: 'errors:server-error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 397 KiB After Width: | Height: | Size: 397 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.5 KiB |
@ -1,51 +0,0 @@
|
||||
{
|
||||
"name": "Thream",
|
||||
"short_name": "Thream",
|
||||
"theme_color": "#27B05E",
|
||||
"background_color": "#262B3F",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"icons": [
|
||||
{
|
||||
"src": "images/icons/72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/128x128.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/152x152.png",
|
||||
"sizes": "152x152",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "images/icons/512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
import axios from 'axios'
|
||||
|
||||
export const API_VERSION = '1.2.3'
|
||||
export const API_VERSION = '1.2.8'
|
||||
|
||||
export const API_DEFAULT_PORT = 8080
|
||||
|
||||
export const API_URL =
|
||||
process.env.NEXT_PUBLIC_API_URL != null
|
||||
? process.env.NEXT_PUBLIC_API_URL
|
||||
process.env['NEXT_PUBLIC_API_URL'] != null
|
||||
? process.env['NEXT_PUBLIC_API_URL']
|
||||
: `http://127.0.0.1:${API_DEFAULT_PORT}`
|
||||
|
||||
export const api = axios.create({
|
||||
|
@ -2,6 +2,7 @@ import type { AxiosInstance } from 'axios'
|
||||
import axios from 'axios'
|
||||
import type { Socket } from 'socket.io-client'
|
||||
import { io } from 'socket.io-client'
|
||||
import { isUnauthorizedError } from '@thream/socketio-jwt'
|
||||
|
||||
import { API_URL } from '../api'
|
||||
import { cookies } from '../cookies'
|
||||
@ -30,7 +31,7 @@ export class Authentication {
|
||||
)
|
||||
})
|
||||
this.socket.on('connect_error', (error) => {
|
||||
if (error.message.startsWith('Unauthorized')) {
|
||||
if (isUnauthorizedError(error)) {
|
||||
fetchRefreshToken(this.tokens.refreshToken)
|
||||
.then(({ accessToken }) => {
|
||||
this.setAccessToken(accessToken)
|
||||
@ -58,7 +59,6 @@ export class Authentication {
|
||||
)
|
||||
this.setAccessToken(accessToken)
|
||||
}
|
||||
config.headers = config.headers == null ? {} : config.headers
|
||||
config.headers.Authorization = `${this.tokens.type} ${this.tokens.accessToken}`
|
||||
return config
|
||||
},
|
||||
@ -96,7 +96,7 @@ export class Authentication {
|
||||
this.accessTokenAge = Date.now()
|
||||
const token = `${this.tokens.type} ${this.tokens.accessToken}`
|
||||
if (typeof this?.socket?.auth !== 'function' && this.socket != null) {
|
||||
this.socket.auth.token = token
|
||||
this.socket.auth['token'] = token
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
{
|
||||
"extends": "@tsconfig/strictest/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"lib": ["dom", "dom.iterable", "ESNext"],
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"jsx": "preserve",
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"types": ["cypress"],
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"incremental": true
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
"exclude": ["dist", ".next", "out", "next.config.js"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
"types": ["cypress"],
|
||||
"noEmit": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"exactOptionalPropertyTypes": false,
|
||||
"verbatimModuleSyntax": false,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"$schema": "https://openapi.vercel.sh/vercel.json",
|
||||
"github": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|