Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
177676e180 | |||
db4ab7cf6f | |||
8f9ff8de07 | |||
21ee6f1d66 | |||
10b1e568d2 | |||
1882073973 | |||
567829fa3a | |||
c0e2c547ef | |||
f555e406ef | |||
4cd817bb01 | |||
41e9162454 | |||
ff2decc894 | |||
d44a401348 | |||
cb2ddbf661 | |||
25261b54ef | |||
0028974c3b | |||
4141f1eeab | |||
5ef8f18060 | |||
8bb4ef8b54 | |||
32f2edd7fc | |||
4799acbc29 | |||
0d6aa0a78f |
@ -1,5 +1,3 @@
|
|||||||
version: '3.0'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
workspace:
|
workspace:
|
||||||
build:
|
build:
|
||||||
|
2
.github/workflows/analyze.yml
vendored
2
.github/workflows/analyze.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
language: ['javascript']
|
language: ['javascript']
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2.3.4'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
- name: 'Initialize CodeQL'
|
- name: 'Initialize CodeQL'
|
||||||
uses: 'github/codeql-action/init@v1'
|
uses: 'github/codeql-action/init@v1'
|
||||||
|
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -10,10 +10,10 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
- name: 'Use Node.js'
|
- name: 'Use Node.js'
|
||||||
uses: 'actions/setup-node@v2.4.1'
|
uses: 'actions/setup-node@v3.0.0'
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
@ -10,10 +10,10 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
- name: 'Use Node.js'
|
- name: 'Use Node.js'
|
||||||
uses: 'actions/setup-node@v2.4.1'
|
uses: 'actions/setup-node@v3.0.0'
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2.3.4'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
@ -10,10 +10,10 @@ jobs:
|
|||||||
test-unit:
|
test-unit:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2.3.4'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
- name: 'Use Node.js'
|
- name: 'Use Node.js'
|
||||||
uses: 'actions/setup-node@v2.4.1'
|
uses: 'actions/setup-node@v3.0.0'
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -27,10 +27,10 @@ jobs:
|
|||||||
test-lighthouse:
|
test-lighthouse:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2.3.4'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
- name: 'Use Node.js'
|
- name: 'Use Node.js'
|
||||||
uses: 'actions/setup-node@v2.4.0'
|
uses: 'actions/setup-node@v3.0.0'
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -41,9 +41,6 @@ jobs:
|
|||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
run: 'npm run build'
|
run: 'npm run build'
|
||||||
|
|
||||||
- name: 'html-w3c-validator'
|
|
||||||
run: 'npm run test:html-w3c-validator'
|
|
||||||
|
|
||||||
- name: 'Lighthouse'
|
- name: 'Lighthouse'
|
||||||
run: 'npm run test:lighthouse'
|
run: 'npm run test:lighthouse'
|
||||||
env:
|
env:
|
||||||
@ -52,10 +49,10 @@ jobs:
|
|||||||
test-e2e:
|
test-e2e:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v2.3.4'
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
- name: 'Use Node.js'
|
- name: 'Use Node.js'
|
||||||
uses: 'actions/setup-node@v2.4.0'
|
uses: 'actions/setup-node@v3.0.0'
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"urls": [
|
|
||||||
"http://localhost:3000/",
|
|
||||||
"http://localhost:3000/authentication/forgot-password",
|
|
||||||
"http://localhost:3000/authentication/reset-password",
|
|
||||||
"http://localhost:3000/authentication/signin",
|
|
||||||
"http://localhost:3000/authentication/signup"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,15 +1,15 @@
|
|||||||
FROM node:16.14.2 AS dependencies
|
FROM node:16.15.0 AS dependencies
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY ./package*.json ./
|
COPY ./package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
FROM node:16.14.2 AS builder
|
FROM node:16.15.0 AS builder
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY ./ ./
|
COPY ./ ./
|
||||||
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
|
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:16.14.2 AS runner
|
FROM node:16.15.0 AS runner
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
COPY --from=builder /usr/src/app/next.config.js ./next.config.js
|
COPY --from=builder /usr/src/app/next.config.js ./next.config.js
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
Thream's website to stay close with your friends and communities.
|
Thream's website to stay close with your friends and communities.
|
||||||
|
|
||||||
It uses [Thream/api](https://github.com/Thream/api) [v1.0.0](https://github.com/Thream/api/releases/tag/v1.0.0).
|
It uses [Thream/api](https://github.com/Thream/api) [v1.1.0](https://github.com/Thream/api/releases/tag/v1.1.0).
|
||||||
|
|
||||||
## ⚙️ Getting Started
|
## ⚙️ Getting Started
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ npm run dev
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Setup and run all the services for you
|
# Setup and run all the services for you
|
||||||
docker-compose up --build
|
docker compose up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Services started
|
#### Services started
|
||||||
|
@ -40,7 +40,9 @@ export interface ApplicationProps {
|
|||||||
title: string
|
title: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Application: React.FC<ApplicationProps> = (props) => {
|
export const Application: React.FC<
|
||||||
|
React.PropsWithChildren<ApplicationProps>
|
||||||
|
> = (props) => {
|
||||||
const { children, path, guildLeftSidebar, title } = props
|
const { children, path, guildLeftSidebar, title } = props
|
||||||
|
|
||||||
const { user } = useAuthentication()
|
const { user } = useAuthentication()
|
||||||
@ -110,7 +112,7 @@ export const Application: React.FC<ApplicationProps> = (props) => {
|
|||||||
const swipeableHandlers = useSwipeable({
|
const swipeableHandlers = useSwipeable({
|
||||||
trackMouse: false,
|
trackMouse: false,
|
||||||
trackTouch: true,
|
trackTouch: true,
|
||||||
preventDefaultTouchmoveEvent: true,
|
preventScrollOnSwipe: true,
|
||||||
onSwipedRight: () => {
|
onSwipedRight: () => {
|
||||||
if (visibleSidebars.right) {
|
if (visibleSidebars.right) {
|
||||||
return setVisibleSidebars({ ...visibleSidebars, right: false })
|
return setVisibleSidebars({ ...visibleSidebars, right: false })
|
||||||
@ -121,13 +123,15 @@ export const Application: React.FC<ApplicationProps> = (props) => {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onSwipedLeft: () => {
|
onSwipedLeft: () => {
|
||||||
if (visibleSidebars.left) {
|
if (isGuildsChannelsPath(path)) {
|
||||||
return setVisibleSidebars({ ...visibleSidebars, left: false })
|
if (visibleSidebars.left) {
|
||||||
|
return setVisibleSidebars({ ...visibleSidebars, left: false })
|
||||||
|
}
|
||||||
|
setVisibleSidebars({
|
||||||
|
...visibleSidebars,
|
||||||
|
right: true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
setVisibleSidebars({
|
|
||||||
...visibleSidebars,
|
|
||||||
right: true
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -213,7 +217,7 @@ export const Application: React.FC<ApplicationProps> = (props) => {
|
|||||||
id='application-page-content'
|
id='application-page-content'
|
||||||
onClick={handleCloseSidebars}
|
onClick={handleCloseSidebars}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'h-full-without-header top-0 z-0 flex w-full flex-1 flex-col overflow-y-auto transition',
|
'h-full-without-header relative top-0 z-0 flex w-full flex-1 flex-col overflow-y-auto transition',
|
||||||
{
|
{
|
||||||
'absolute opacity-20':
|
'absolute opacity-20':
|
||||||
isMobile && (visibleSidebars.left || visibleSidebars.right)
|
isMobile && (visibleSidebars.left || visibleSidebars.right)
|
||||||
|
@ -2,6 +2,8 @@ import { useRouter } from 'next/router'
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Form } from 'react-component-form'
|
import { Form } from 'react-component-form'
|
||||||
import useTranslation from 'next-translate/useTranslation'
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
import classNames from 'classnames'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
import { HandleSubmitCallback, useForm } from '../../../hooks/useForm'
|
import { HandleSubmitCallback, useForm } from '../../../hooks/useForm'
|
||||||
import { FormState } from '../../design/FormState'
|
import { FormState } from '../../design/FormState'
|
||||||
@ -14,6 +16,7 @@ import {
|
|||||||
channelSchema,
|
channelSchema,
|
||||||
ChannelWithDefaultChannelId
|
ChannelWithDefaultChannelId
|
||||||
} from '../../../models/Channel'
|
} from '../../../models/Channel'
|
||||||
|
import { ConfirmPopup } from '../ConfirmPopup'
|
||||||
|
|
||||||
export interface ChannelSettingsProps {
|
export interface ChannelSettingsProps {
|
||||||
channel: Channel
|
channel: Channel
|
||||||
@ -31,6 +34,12 @@ export const ChannelSettings: React.FC<ChannelSettingsProps> = (props) => {
|
|||||||
name: channel.name
|
name: channel.name
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const [confirmation, setConfirmation] = useState(false)
|
||||||
|
|
||||||
|
const handleConfirmation = (): void => {
|
||||||
|
return setConfirmation(!confirmation)
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
fetchState,
|
fetchState,
|
||||||
message,
|
message,
|
||||||
@ -81,48 +90,69 @@ export const ChannelSettings: React.FC<ChannelSettingsProps> = (props) => {
|
|||||||
await router.push(`/application/${guild.id}/${data.defaultChannelId}`)
|
await router.push(`/application/${guild.id}/${data.defaultChannelId}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setFetchState('error')
|
setFetchState('error')
|
||||||
setMessageTranslationKey('errors:server-error')
|
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
||||||
|
setMessageTranslationKey('application:delete-channel-only-one')
|
||||||
|
} else {
|
||||||
|
setMessageTranslationKey('errors:server-error')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<>
|
||||||
onSubmit={handleSubmit(onSubmit)}
|
<Form
|
||||||
className='my-auto flex flex-col items-center justify-center py-12'
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
>
|
className='my-auto flex flex-col items-center justify-center py-12'
|
||||||
<div className='flex w-full flex-col items-center justify-center sm:w-fit lg:flex-row'>
|
>
|
||||||
<div className=' flex w-full flex-wrap items-center justify-center px-6 sm:w-max'>
|
<div className='flex w-full flex-col items-center justify-center sm:w-fit lg:flex-row'>
|
||||||
<div className='mx-12 flex flex-col'>
|
<div className=' flex w-full flex-wrap items-center justify-center px-6 sm:w-max'>
|
||||||
<Input
|
<div className='mx-12 flex flex-col'>
|
||||||
name='name'
|
<Input
|
||||||
label={t('common:name')}
|
name='name'
|
||||||
placeholder={t('common:name')}
|
label={t('common:name')}
|
||||||
className='!mt-0'
|
placeholder={t('common:name')}
|
||||||
onChange={onChange}
|
className='!mt-0'
|
||||||
value={inputValues.name}
|
onChange={onChange}
|
||||||
error={getErrorTranslation(errors.name)}
|
value={inputValues.name}
|
||||||
data-cy='channel-name-input'
|
error={getErrorTranslation(errors.name)}
|
||||||
/>
|
data-cy='channel-name-input'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='mt-12 flex flex-col items-center justify-center sm:w-fit'>
|
<div className='mt-12 flex flex-col items-center justify-center sm:w-fit'>
|
||||||
<div className='space-x-6'>
|
<div className='space-x-6'>
|
||||||
<Button type='submit' data-cy='button-save-channel-settings'>
|
<Button type='submit' data-cy='button-save-channel-settings'>
|
||||||
{t('application:save')}
|
{t('application:save')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type='button'
|
type='button'
|
||||||
color='red'
|
color='red'
|
||||||
onClick={handleDelete}
|
onClick={handleConfirmation}
|
||||||
data-cy='button-delete-channel-settings'
|
data-cy='button-delete-channel-settings'
|
||||||
>
|
>
|
||||||
{t('application:delete')}
|
{t('application:delete')}
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
|
<FormState state={fetchState} message={message} />
|
||||||
</div>
|
</div>
|
||||||
<FormState state={fetchState} message={message} />
|
</Form>
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'pointer-events-none invisible absolute z-50 flex h-full w-full items-center justify-center bg-black bg-opacity-90 opacity-0 backdrop-blur-md transition-all',
|
||||||
|
{ 'pointer-events-auto !visible !opacity-100': confirmation }
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<ConfirmPopup
|
||||||
|
className={classNames('relative top-8 transition-all', {
|
||||||
|
'!top-0': confirmation
|
||||||
|
})}
|
||||||
|
handleYes={handleDelete}
|
||||||
|
handleNo={handleConfirmation}
|
||||||
|
title={`${t('application:delete-the-channel')} ?`}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export * from './ConfirmGuildJoin'
|
|
@ -5,15 +5,14 @@ import classNames from 'classnames'
|
|||||||
|
|
||||||
import { Loader } from '../../design/Loader'
|
import { Loader } from '../../design/Loader'
|
||||||
|
|
||||||
export interface ConfirmGuildJoinProps {
|
export interface ConfirmPopupProps {
|
||||||
className?: string
|
className?: string
|
||||||
|
title: string
|
||||||
handleYes: () => void | Promise<void>
|
handleYes: () => void | Promise<void>
|
||||||
handleNo: () => void | Promise<void>
|
handleNo: () => void | Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ConfirmGuildJoin: React.FC<ConfirmGuildJoinProps> = ({
|
export const ConfirmPopup: React.FC<ConfirmPopupProps> = ({ ...props }) => {
|
||||||
...props
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
@ -25,9 +24,12 @@ export const ConfirmGuildJoin: React.FC<ConfirmGuildJoinProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div className={props.className}>
|
<div className={props.className}>
|
||||||
<Loader
|
<Loader
|
||||||
className={classNames('absolute scale-0 transition', {
|
className={classNames(
|
||||||
'scale-100': isLoading
|
'absolute top-1/2 left-1/2 scale-0 transition-all',
|
||||||
})}
|
{
|
||||||
|
'scale-100': isLoading
|
||||||
|
}
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@ -40,24 +42,24 @@ export const ConfirmGuildJoin: React.FC<ConfirmGuildJoinProps> = ({
|
|||||||
<Image
|
<Image
|
||||||
quality={100}
|
quality={100}
|
||||||
src='/images/svg/design/join-guild.svg'
|
src='/images/svg/design/join-guild.svg'
|
||||||
alt='Join Guild Illustration'
|
alt='Illustration'
|
||||||
height={150}
|
height={150}
|
||||||
width={150}
|
width={150}
|
||||||
/>
|
/>
|
||||||
<div className='mt-8 flex flex-col'>
|
<div className='mt-8 flex flex-col'>
|
||||||
<h1 className='mb-6 text-center text-xl'>
|
<h1 className='mb-6 text-center text-xl'>{props.title}</h1>
|
||||||
{t('application:join-the-guild')} ?
|
|
||||||
</h1>
|
|
||||||
<div className='flex gap-7'>
|
<div className='flex gap-7'>
|
||||||
<button
|
<button
|
||||||
className='rounded-3xl bg-success px-8 py-2 text-white transition hover:brightness-125 dark:text-black hover:dark:brightness-75'
|
className='rounded-3xl bg-success px-8 py-2 text-white transition hover:brightness-125 dark:text-black hover:dark:brightness-75'
|
||||||
onClick={handleYesLoading}
|
onClick={handleYesLoading}
|
||||||
|
data-cy='confirm-popup-yes-button'
|
||||||
>
|
>
|
||||||
{t('common:yes')}
|
{t('common:yes')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className='rounded-3xl bg-error px-8 py-2 text-white transition hover:brightness-125 dark:text-black hover:dark:brightness-75'
|
className='rounded-3xl bg-error px-8 py-2 text-white transition hover:brightness-125 dark:text-black hover:dark:brightness-75'
|
||||||
onClick={props.handleNo}
|
onClick={props.handleNo}
|
||||||
|
data-cy='confirm-popup-no-button'
|
||||||
>
|
>
|
||||||
{t('common:no')}
|
{t('common:no')}
|
||||||
</button>
|
</button>
|
1
components/Application/ConfirmPopup/index.ts
Normal file
1
components/Application/ConfirmPopup/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './ConfirmPopup'
|
@ -5,6 +5,7 @@ import { Type } from '@sinclair/typebox'
|
|||||||
import { PhotographIcon } from '@heroicons/react/solid'
|
import { PhotographIcon } from '@heroicons/react/solid'
|
||||||
import { Form } from 'react-component-form'
|
import { Form } from 'react-component-form'
|
||||||
import useTranslation from 'next-translate/useTranslation'
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
import classNames from 'classnames'
|
||||||
|
|
||||||
import { HandleSubmitCallback, useForm } from '../../../hooks/useForm'
|
import { HandleSubmitCallback, useForm } from '../../../hooks/useForm'
|
||||||
import { guildSchema } from '../../../models/Guild'
|
import { guildSchema } from '../../../models/Guild'
|
||||||
@ -14,6 +15,7 @@ import { Textarea } from '../../design/Textarea'
|
|||||||
import { Input } from '../../design/Input'
|
import { Input } from '../../design/Input'
|
||||||
import { Button } from '../../design/Button'
|
import { Button } from '../../design/Button'
|
||||||
import { useAuthentication } from '../../../tools/authentication'
|
import { useAuthentication } from '../../../tools/authentication'
|
||||||
|
import { ConfirmPopup } from '../ConfirmPopup'
|
||||||
|
|
||||||
export const GuildSettings: React.FC = () => {
|
export const GuildSettings: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@ -26,6 +28,12 @@ export const GuildSettings: React.FC = () => {
|
|||||||
description: guild.description
|
description: guild.description
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const [confirmation, setConfirmation] = useState(false)
|
||||||
|
|
||||||
|
const handleConfirmation = (): void => {
|
||||||
|
return setConfirmation(!confirmation)
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
fetchState,
|
fetchState,
|
||||||
message,
|
message,
|
||||||
@ -109,95 +117,112 @@ export const GuildSettings: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<>
|
||||||
onSubmit={handleSubmit(onSubmit)}
|
<Form
|
||||||
className='my-auto flex flex-col items-center justify-center py-12'
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
>
|
className='my-auto flex flex-col items-center justify-center py-12'
|
||||||
{member.isOwner && (
|
>
|
||||||
<div className='flex w-full flex-col items-center justify-center sm:w-fit lg:flex-row'>
|
{member.isOwner && (
|
||||||
<div className=' flex w-full flex-wrap items-center justify-center px-6 sm:w-max'>
|
<div className='flex w-full flex-col items-center justify-center sm:w-fit lg:flex-row'>
|
||||||
<div className='relative'>
|
<div className=' flex w-full flex-wrap items-center justify-center px-6 sm:w-max'>
|
||||||
<div className='absolute z-50 h-full w-full'>
|
<div className='relative'>
|
||||||
<button className='relative flex h-full w-full items-center justify-center transition hover:scale-110'>
|
<div className='absolute z-50 h-full w-full'>
|
||||||
<input
|
<button className='relative flex h-full w-full items-center justify-center transition hover:scale-110'>
|
||||||
type='file'
|
<input
|
||||||
className='absolute h-full w-full cursor-pointer opacity-0'
|
type='file'
|
||||||
onChange={handleFileChange}
|
className='absolute h-full w-full cursor-pointer opacity-0'
|
||||||
|
onChange={handleFileChange}
|
||||||
|
/>
|
||||||
|
<PhotographIcon color='white' className='h-8 w-8' />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className='flex items-center justify-center rounded-full bg-black shadow-xl'>
|
||||||
|
<Image
|
||||||
|
quality={100}
|
||||||
|
className='rounded-full opacity-50'
|
||||||
|
src={
|
||||||
|
guild.icon == null
|
||||||
|
? '/images/data/guild-default.png'
|
||||||
|
: guild.icon
|
||||||
|
}
|
||||||
|
alt='Profil Picture'
|
||||||
|
draggable='false'
|
||||||
|
height={125}
|
||||||
|
width={125}
|
||||||
/>
|
/>
|
||||||
<PhotographIcon color='white' className='h-8 w-8' />
|
</div>
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div className='flex items-center justify-center rounded-full bg-black shadow-xl'>
|
<div className='mx-12 flex flex-col'>
|
||||||
<Image
|
<Input
|
||||||
quality={100}
|
name='name'
|
||||||
className='rounded-full opacity-50'
|
label={t('common:name')}
|
||||||
src={
|
placeholder={t('common:name')}
|
||||||
guild.icon == null
|
className='!mt-0'
|
||||||
? '/images/data/guild-default.png'
|
onChange={onChange}
|
||||||
: guild.icon
|
value={inputValues.name}
|
||||||
}
|
error={getErrorTranslation(errors.name)}
|
||||||
alt='Profil Picture'
|
data-cy='guild-name-input'
|
||||||
draggable='false'
|
/>
|
||||||
height={125}
|
<Textarea
|
||||||
width={125}
|
name='description'
|
||||||
|
label={'Description'}
|
||||||
|
placeholder={'Description'}
|
||||||
|
id='textarea-description'
|
||||||
|
onChange={onChange}
|
||||||
|
value={inputValues.description ?? ''}
|
||||||
|
data-cy='guild-description-input'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='mx-12 flex flex-col'>
|
|
||||||
<Input
|
|
||||||
name='name'
|
|
||||||
label={t('common:name')}
|
|
||||||
placeholder={t('common:name')}
|
|
||||||
className='!mt-0'
|
|
||||||
onChange={onChange}
|
|
||||||
value={inputValues.name}
|
|
||||||
error={getErrorTranslation(errors.name)}
|
|
||||||
data-cy='guild-name-input'
|
|
||||||
/>
|
|
||||||
<Textarea
|
|
||||||
name='description'
|
|
||||||
label={'Description'}
|
|
||||||
placeholder={'Description'}
|
|
||||||
id='textarea-description'
|
|
||||||
onChange={onChange}
|
|
||||||
value={inputValues.description ?? ''}
|
|
||||||
data-cy='guild-description-input'
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
)}
|
<div className='mt-12 flex flex-col items-center justify-center sm:w-fit'>
|
||||||
<div className='mt-12 flex flex-col items-center justify-center sm:w-fit'>
|
<div className='space-x-6'>
|
||||||
<div className='space-x-6'>
|
{member.isOwner ? (
|
||||||
{member.isOwner ? (
|
<>
|
||||||
<>
|
<Button type='submit' data-cy='button-save-guild-settings'>
|
||||||
<Button type='submit' data-cy='button-save-guild-settings'>
|
{t('application:save')}
|
||||||
{t('application:save')}
|
</Button>
|
||||||
</Button>
|
<Button
|
||||||
|
type='button'
|
||||||
|
color='red'
|
||||||
|
onClick={handleConfirmation}
|
||||||
|
data-cy='button-delete-guild-settings'
|
||||||
|
>
|
||||||
|
{t('application:delete')}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
<Button
|
<Button
|
||||||
type='button'
|
|
||||||
color='red'
|
color='red'
|
||||||
onClick={handleDelete}
|
onClick={handleLeave}
|
||||||
data-cy='button-delete-guild-settings'
|
data-cy='button-leave-guild-settings'
|
||||||
>
|
>
|
||||||
{t('application:delete')}
|
{t('application:leave')} {guild.name}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
)}
|
||||||
) : (
|
</div>
|
||||||
<Button
|
<FormState
|
||||||
color='red'
|
state={fetchState}
|
||||||
onClick={handleLeave}
|
message={getErrorTranslation(errors.description) ?? message}
|
||||||
data-cy='button-leave-guild-settings'
|
/>
|
||||||
>
|
|
||||||
{t('application:leave')} {guild.name}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<FormState
|
</Form>
|
||||||
state={fetchState}
|
<div
|
||||||
message={getErrorTranslation(errors.description) ?? message}
|
className={classNames(
|
||||||
|
'pointer-events-none invisible absolute z-50 flex h-full w-full items-center justify-center bg-black bg-opacity-90 opacity-0 backdrop-blur-md transition-all',
|
||||||
|
{ 'pointer-events-auto !visible !opacity-100': confirmation }
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<ConfirmPopup
|
||||||
|
className={classNames('relative top-8 transition-all', {
|
||||||
|
'!top-0': confirmation
|
||||||
|
})}
|
||||||
|
handleYes={handleDelete}
|
||||||
|
handleNo={handleConfirmation}
|
||||||
|
title={`${t('application:delete-the-guild')} ?`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import classNames from 'classnames'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import { Emoji } from '../../../Emoji'
|
import { Emoji } from '../../../Emoji'
|
||||||
import { ConfirmGuildJoin } from '../../ConfirmGuildJoin'
|
import { ConfirmPopup } from '../../ConfirmPopup'
|
||||||
import {
|
import {
|
||||||
GuildPublic as GuildPublicType,
|
GuildPublic as GuildPublicType,
|
||||||
GuildWithDefaultChannelId
|
GuildWithDefaultChannelId
|
||||||
@ -40,7 +40,7 @@ export const GuildPublic: React.FC<GuildPublicProps> = (props) => {
|
|||||||
if (
|
if (
|
||||||
axios.isAxiosError(error) &&
|
axios.isAxiosError(error) &&
|
||||||
error.response?.status === 400 &&
|
error.response?.status === 400 &&
|
||||||
typeof error.response?.data.defaultChannelId === 'number'
|
typeof error?.response?.data.defaultChannelId === 'number'
|
||||||
) {
|
) {
|
||||||
const defaultChannelId = error.response.data.defaultChannelId as number
|
const defaultChannelId = error.response.data.defaultChannelId as number
|
||||||
await router.push(`/application/${guild.id}/${defaultChannelId}`)
|
await router.push(`/application/${guild.id}/${defaultChannelId}`)
|
||||||
@ -91,7 +91,8 @@ export const GuildPublic: React.FC<GuildPublicProps> = (props) => {
|
|||||||
{guild.membersCount} {t('application:members')}
|
{guild.membersCount} {t('application:members')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ConfirmGuildJoin
|
<ConfirmPopup
|
||||||
|
title={`${t('application:join-the-guild')} ?`}
|
||||||
className={classNames(
|
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 top-1/2 left-full flex h-full w-full -translate-y-1/2 flex-col items-center justify-center rounded-2xl transition-all',
|
||||||
{
|
{
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
import { render } from '@testing-library/react'
|
|
||||||
|
|
||||||
import { Member } from './Member'
|
|
||||||
import { memberExampleComplete } from '../../../../cypress/fixtures/members/member'
|
|
||||||
|
|
||||||
describe('<Member />', () => {
|
|
||||||
it('should render successfully', () => {
|
|
||||||
const { baseElement } = render(<Member member={memberExampleComplete} />)
|
|
||||||
expect(baseElement).toBeTruthy()
|
|
||||||
})
|
|
||||||
})
|
|
@ -2,6 +2,7 @@ import Image from 'next/image'
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
import { MemberWithPublicUser } from '../../../../models/Member'
|
import { MemberWithPublicUser } from '../../../../models/Member'
|
||||||
|
import { Emoji } from '../../../Emoji'
|
||||||
|
|
||||||
export interface MemberProps {
|
export interface MemberProps {
|
||||||
member: MemberWithPublicUser
|
member: MemberWithPublicUser
|
||||||
@ -29,8 +30,13 @@ export const Member: React.FC<MemberProps> = (props) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className='ml-5'>
|
<div className='ml-5'>
|
||||||
<p data-cy='member-user-name' className='truncate font-bold'>
|
<p data-cy='member-user-name' className='flex truncate font-bold'>
|
||||||
{member.user.name}
|
{member.user.name}
|
||||||
|
{member.isOwner && (
|
||||||
|
<span className='ml-4'>
|
||||||
|
<Emoji value=':crown:' size={18} />
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
{member.user.status != null && member.user.status}
|
{member.user.status != null && member.user.status}
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,8 @@ import gfm from 'remark-gfm'
|
|||||||
import remarkBreaks from 'remark-breaks'
|
import remarkBreaks from 'remark-breaks'
|
||||||
import remarkMath from 'remark-math'
|
import remarkMath from 'remark-math'
|
||||||
import rehypeKatex from 'rehype-katex'
|
import rehypeKatex from 'rehype-katex'
|
||||||
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
||||||
|
import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism'
|
||||||
|
|
||||||
import 'katex/dist/katex.min.css'
|
import 'katex/dist/katex.min.css'
|
||||||
|
|
||||||
@ -41,6 +43,24 @@ export const MessageText: React.FC<MessageContentProps> = (props) => {
|
|||||||
components={{
|
components={{
|
||||||
emoji: (props) => {
|
emoji: (props) => {
|
||||||
return <Emoji value={props.value} size={20} />
|
return <Emoji value={props.value} size={20} />
|
||||||
|
},
|
||||||
|
code: (properties) => {
|
||||||
|
const { inline, className, children, ...props } = properties
|
||||||
|
const match = /language-(\w+)/.exec(className ?? '')
|
||||||
|
return !(inline as boolean) && match != null ? (
|
||||||
|
<SyntaxHighlighter
|
||||||
|
style={vscDarkPlus as any}
|
||||||
|
language={match[1]}
|
||||||
|
PreTag='div'
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{String(children).replace(/\n$/, '')}
|
||||||
|
</SyntaxHighlighter>
|
||||||
|
) : (
|
||||||
|
<code className={className} {...props}>
|
||||||
|
{children}
|
||||||
|
</code>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -11,7 +11,9 @@ export interface SidebarProps {
|
|||||||
isMobile: boolean
|
isMobile: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Sidebar: React.FC<SidebarProps> = (props) => {
|
export const Sidebar: React.FC<React.PropsWithChildren<SidebarProps>> = (
|
||||||
|
props
|
||||||
|
) => {
|
||||||
const { direction, visible, children, path, isMobile } = props
|
const { direction, visible, children, path, isMobile } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -16,84 +16,96 @@ export const UserProfile: React.FC<UserProfileProps> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative flex h-full flex-col items-center justify-center'>
|
<>
|
||||||
<div className='transition'>
|
<div className='relative flex h-full flex-col items-center justify-center'>
|
||||||
<div className='max-w-[1000px] px-12'>
|
<div className='transition'>
|
||||||
<div className='flex items-center justify-between'>
|
<div className='max-w-[1000px] px-12'>
|
||||||
<div className='flex w-max items-center'>
|
<div className='flex items-center justify-between'>
|
||||||
<div className='relative flex items-center justify-center overflow-hidden rounded-full shadow-lg transition-all'>
|
<div className='flex w-max flex-col items-center gap-7 md:flex-row'>
|
||||||
<Image
|
<div className='relative flex items-center justify-center overflow-hidden rounded-full shadow-lg transition-all'>
|
||||||
quality={100}
|
<Image
|
||||||
className='rounded-full'
|
quality={100}
|
||||||
src={
|
className='rounded-full'
|
||||||
user.logo != null
|
src={
|
||||||
? user.logo
|
user.logo != null
|
||||||
: '/images/data/user-default.png'
|
? user.logo
|
||||||
}
|
: '/images/data/user-default.png'
|
||||||
alt='Profil Picture'
|
}
|
||||||
draggable='false'
|
alt='Profil Picture'
|
||||||
height={125}
|
draggable='false'
|
||||||
width={125}
|
height={125}
|
||||||
/>
|
width={125}
|
||||||
</div>
|
/>
|
||||||
<div className='ml-10 flex flex-col'>
|
|
||||||
<div className='mb-2 flex items-center'>
|
|
||||||
<p
|
|
||||||
className='space text-dark text-3xl font-bold tracking-wide dark:text-white'
|
|
||||||
data-cy='user-name'
|
|
||||||
>
|
|
||||||
{user.name}
|
|
||||||
</p>
|
|
||||||
<p
|
|
||||||
className='ml-8 select-none text-sm tracking-widest text-white opacity-40'
|
|
||||||
data-cy='user-createdAt'
|
|
||||||
>
|
|
||||||
{date.format(new Date(user.createdAt), 'DD/MM/YYYY')}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div className='my-2 text-left'>
|
<div className='ml-10 flex flex-col'>
|
||||||
{user.email != null && (
|
<div className='mb-2 flex items-center'>
|
||||||
<p className='font-bold'>
|
<p
|
||||||
Email:{' '}
|
className='space text-dark text-3xl font-bold tracking-wide dark:text-white'
|
||||||
<a
|
data-cy='user-name'
|
||||||
href={`mailto:${user.email}`}
|
>
|
||||||
target='_blank'
|
{user.name}
|
||||||
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'
|
|
||||||
rel='noreferrer'
|
|
||||||
data-cy='user-email'
|
|
||||||
>
|
|
||||||
{user.email}
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
<p
|
||||||
{user.website != null && (
|
className='ml-8 select-none text-sm tracking-widest text-white opacity-40'
|
||||||
<p className='font-bold'>
|
data-cy='user-createdAt'
|
||||||
{t('application:website')}:{' '}
|
>
|
||||||
<a
|
{date.format(new Date(user.createdAt), 'DD/MM/YYYY')}
|
||||||
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'
|
|
||||||
>
|
|
||||||
{user.website}
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
</div>
|
||||||
{user.status != null && (
|
<div className='my-2 text-left'>
|
||||||
<p className='flex font-bold'>
|
{user.email != null && (
|
||||||
{t('application:status')}:{' '}
|
<p className='font-bold'>
|
||||||
<span className='ml-2 font-normal tracking-wide'>
|
Email:{' '}
|
||||||
{user.status}
|
<a
|
||||||
</span>
|
href={`mailto:${user.email}`}
|
||||||
</p>
|
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'
|
||||||
|
rel='noreferrer'
|
||||||
|
data-cy='user-email'
|
||||||
|
>
|
||||||
|
{user.email}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{user.website != null && (
|
||||||
|
<p className='font-bold'>
|
||||||
|
{t('application:website')}:{' '}
|
||||||
|
<a
|
||||||
|
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'
|
||||||
|
>
|
||||||
|
{user.website}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{user.status != null && (
|
||||||
|
<p className='flex font-bold'>
|
||||||
|
{t('application:status')}:{' '}
|
||||||
|
<span className='ml-2 font-normal tracking-wide'>
|
||||||
|
{user.status}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{user.biography != null && (
|
||||||
<div className='mt-7'>
|
<div className='mt-7 text-center'>
|
||||||
{user.biography != null && <p>{user.biography}</p>}
|
<p>{user.biography}</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<style jsx global>{`
|
||||||
|
#application-page-content {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,10 @@ export const UserSettings: React.FC = () => {
|
|||||||
return {
|
return {
|
||||||
...oldUser,
|
...oldUser,
|
||||||
...userCurrentData,
|
...userCurrentData,
|
||||||
settings: userCurrentSettings.settings
|
settings: {
|
||||||
|
...oldUser.settings,
|
||||||
|
...userCurrentSettings.settings
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
@ -13,7 +13,7 @@ export const Head: React.FC<HeadProps> = (props) => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
title = 'Thream',
|
title = 'Thream',
|
||||||
image = '/images/icons/96x96.png',
|
image = 'https://thream.divlo.fr/images/icons/128x128.png',
|
||||||
description = t('common:description'),
|
description = t('common:description'),
|
||||||
url = 'https://thream.divlo.fr/'
|
url = 'https://thream.divlo.fr/'
|
||||||
} = props
|
} = props
|
||||||
@ -42,7 +42,7 @@ export const Head: React.FC<HeadProps> = (props) => {
|
|||||||
<meta name='twitter:card' content='summary' />
|
<meta name='twitter:card' content='summary' />
|
||||||
<meta name='twitter:description' content={description} />
|
<meta name='twitter:description' content={description} />
|
||||||
<meta name='twitter:title' content={title} />
|
<meta name='twitter:title' content={title} />
|
||||||
<meta name='twitter:image:src' content={image} />
|
<meta name='twitter:image' content={image} />
|
||||||
|
|
||||||
{/* PWA Data */}
|
{/* PWA Data */}
|
||||||
<link rel='manifest' href='/manifest.json' />
|
<link rel='manifest' href='/manifest.json' />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState, useRef } from 'react'
|
||||||
import useTranslation from 'next-translate/useTranslation'
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
import setLanguage from 'next-translate/setLanguage'
|
import setLanguage from 'next-translate/setLanguage'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
@ -15,31 +15,37 @@ export const Language: React.FC<LanguageProps> = (props) => {
|
|||||||
const { className } = props
|
const { className } = props
|
||||||
const { lang: currentLanguage } = useTranslation()
|
const { lang: currentLanguage } = useTranslation()
|
||||||
const [hiddenMenu, setHiddenMenu] = useState(true)
|
const [hiddenMenu, setHiddenMenu] = useState(true)
|
||||||
|
const languageClickRef = useRef<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
const handleHiddenMenu = useCallback(() => {
|
const handleHiddenMenu = useCallback(() => {
|
||||||
setHiddenMenu(!hiddenMenu)
|
setHiddenMenu((oldHiddenMenu) => !oldHiddenMenu)
|
||||||
}, [hiddenMenu])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!hiddenMenu) {
|
const handleClickEvent = (event: MouseEvent): void => {
|
||||||
window.document.addEventListener('click', handleHiddenMenu)
|
if (languageClickRef.current == null || event.target == null) {
|
||||||
} else {
|
return
|
||||||
window.document.removeEventListener('click', handleHiddenMenu)
|
}
|
||||||
|
if (!languageClickRef.current.contains(event.target as Node)) {
|
||||||
|
setHiddenMenu(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.document.addEventListener('click', handleClickEvent)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
window.document.removeEventListener('click', handleHiddenMenu)
|
return window.removeEventListener('click', handleClickEvent)
|
||||||
}
|
}
|
||||||
}, [hiddenMenu, handleHiddenMenu])
|
}, [])
|
||||||
|
|
||||||
const handleLanguage = async (language: string): Promise<void> => {
|
const handleLanguage = async (language: string): Promise<void> => {
|
||||||
await setLanguage(language)
|
await setLanguage(language)
|
||||||
handleHiddenMenu()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative flex cursor-pointer flex-col items-center justify-center'>
|
<div className='relative flex cursor-pointer flex-col items-center justify-center'>
|
||||||
<div
|
<div
|
||||||
|
ref={languageClickRef}
|
||||||
data-cy='language-click'
|
data-cy='language-click'
|
||||||
className='mr-5 flex items-center'
|
className='mr-5 flex items-center'
|
||||||
onClick={handleHiddenMenu}
|
onClick={handleHiddenMenu}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
export const ScrollableBody: React.FC = (props) => {
|
export const ScrollableBody: React.FC<React.PropsWithChildren<{}>> = (
|
||||||
|
props
|
||||||
|
) => {
|
||||||
const { children } = props
|
const { children } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -8,7 +8,9 @@ export interface IconLinkProps {
|
|||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IconLink: React.FC<IconLinkProps> = (props) => {
|
export const IconLink: React.FC<React.PropsWithChildren<IconLinkProps>> = (
|
||||||
|
props
|
||||||
|
) => {
|
||||||
const { children, selected, href, title, className } = props
|
const { children, selected, href, title, className } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -4,7 +4,7 @@ export interface MainProps {
|
|||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Main: React.FC<MainProps> = (props) => {
|
export const Main: React.FC<React.PropsWithChildren<MainProps>> = (props) => {
|
||||||
const { children, className } = props
|
const { children, className } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -20,7 +20,9 @@ export interface ChannelsProviderProps {
|
|||||||
path: GuildsChannelsPath
|
path: GuildsChannelsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ChannelsProvider: React.FC<ChannelsProviderProps> = (props) => {
|
export const ChannelsProvider: React.FC<
|
||||||
|
React.PropsWithChildren<ChannelsProviderProps>
|
||||||
|
> = (props) => {
|
||||||
const { path, children } = props
|
const { path, children } = props
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { authentication } = useAuthentication()
|
const { authentication } = useAuthentication()
|
||||||
|
@ -27,7 +27,9 @@ const GuildMemberContext = createContext<GuildMemberResult>(
|
|||||||
defaultGuildMemberContext
|
defaultGuildMemberContext
|
||||||
)
|
)
|
||||||
|
|
||||||
export const GuildMemberProvider: React.FC<GuildMemberProps> = (props) => {
|
export const GuildMemberProvider: React.FC<
|
||||||
|
React.PropsWithChildren<GuildMemberProps>
|
||||||
|
> = (props) => {
|
||||||
const { path, children } = props
|
const { path, children } = props
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [guildMember, setGuildMember] = useState(props.guildMember)
|
const [guildMember, setGuildMember] = useState(props.guildMember)
|
||||||
|
@ -14,7 +14,9 @@ export interface Guilds {
|
|||||||
const defaultGuildsContext = {} as any
|
const defaultGuildsContext = {} as any
|
||||||
const GuildsContext = createContext<Guilds>(defaultGuildsContext)
|
const GuildsContext = createContext<Guilds>(defaultGuildsContext)
|
||||||
|
|
||||||
export const GuildsProvider: React.FC = (props) => {
|
export const GuildsProvider: React.FC<React.PropsWithChildren<{}>> = (
|
||||||
|
props
|
||||||
|
) => {
|
||||||
const { children } = props
|
const { children } = props
|
||||||
|
|
||||||
const { authentication } = useAuthentication()
|
const { authentication } = useAuthentication()
|
||||||
|
@ -20,7 +20,9 @@ export interface MembersProviderProps {
|
|||||||
path: GuildsChannelsPath
|
path: GuildsChannelsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MembersProviders: React.FC<MembersProviderProps> = (props) => {
|
export const MembersProviders: React.FC<
|
||||||
|
React.PropsWithChildren<MembersProviderProps>
|
||||||
|
> = (props) => {
|
||||||
const { children, path } = props
|
const { children, path } = props
|
||||||
|
|
||||||
const { authentication } = useAuthentication()
|
const { authentication } = useAuthentication()
|
||||||
|
@ -19,9 +19,11 @@ export interface MessagesProviderProps {
|
|||||||
path: GuildsChannelsPath
|
path: GuildsChannelsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MessagesProvider: React.FC<MessagesProviderProps> = (props) => {
|
export const MessagesProvider: React.FC<
|
||||||
|
React.PropsWithChildren<MessagesProviderProps>
|
||||||
|
> = (props) => {
|
||||||
const { path, children } = props
|
const { path, children } = props
|
||||||
const { authentication } = useAuthentication()
|
const { authentication, user } = useAuthentication()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
items: messages,
|
items: messages,
|
||||||
@ -47,7 +49,10 @@ export const MessagesProvider: React.FC<MessagesProviderProps> = (props) => {
|
|||||||
messagesDiv.scrollHeight - messagesDiv.scrollTop <=
|
messagesDiv.scrollHeight - messagesDiv.scrollTop <=
|
||||||
messagesDiv.clientHeight
|
messagesDiv.clientHeight
|
||||||
handleSocketData({ data, setItems })
|
handleSocketData({ data, setItems })
|
||||||
if (data.action === 'create' && isAtBottom) {
|
if (
|
||||||
|
data.action === 'create' &&
|
||||||
|
(isAtBottom || data.item.member.userId === user.id)
|
||||||
|
) {
|
||||||
messagesDiv.scrollTo(0, messagesDiv.scrollHeight)
|
messagesDiv.scrollTo(0, messagesDiv.scrollHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +62,7 @@ export const MessagesProvider: React.FC<MessagesProviderProps> = (props) => {
|
|||||||
return () => {
|
return () => {
|
||||||
authentication.socket.off('messages')
|
authentication.socket.off('messages')
|
||||||
}
|
}
|
||||||
}, [authentication.socket, setItems, path])
|
}, [authentication.socket, setItems, path, user.id])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
resetPagination()
|
resetPagination()
|
||||||
|
@ -41,9 +41,8 @@ describe('Pages > /application/[guildId]/[channelId]', () => {
|
|||||||
getGuildsHandler
|
getGuildsHandler
|
||||||
]).setCookie('refreshToken', 'refresh-token')
|
]).setCookie('refreshToken', 'refresh-token')
|
||||||
cy.intercept(`${API_URL}${getGuildsHandler.url}*`).as('getGuildsHandler')
|
cy.intercept(`${API_URL}${getGuildsHandler.url}*`).as('getGuildsHandler')
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
|
||||||
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
||||||
cy.wait(['@getGuildsHandler', '@nextStaticAndImages']).then(() => {
|
cy.wait(['@getGuildsHandler']).then(() => {
|
||||||
cy.get('[data-cy=application-title]').should(
|
cy.get('[data-cy=application-title]').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
`# ${channelExample.name}`
|
`# ${channelExample.name}`
|
||||||
@ -74,9 +73,8 @@ describe('Pages > /application/[guildId]/[channelId]', () => {
|
|||||||
getGuildsHandler
|
getGuildsHandler
|
||||||
]).setCookie('refreshToken', 'refresh-token')
|
]).setCookie('refreshToken', 'refresh-token')
|
||||||
cy.intercept(`${API_URL}${getGuildsHandler.url}*`).as('getGuildsHandler')
|
cy.intercept(`${API_URL}${getGuildsHandler.url}*`).as('getGuildsHandler')
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
|
||||||
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
||||||
cy.wait(['@getGuildsHandler', '@nextStaticAndImages']).then(() => {
|
cy.wait(['@getGuildsHandler']).then(() => {
|
||||||
cy.get('[data-cy=application-title]').should(
|
cy.get('[data-cy=application-title]').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
`# ${channelExample.name}`
|
`# ${channelExample.name}`
|
||||||
@ -103,21 +101,18 @@ describe('Pages > /application/[guildId]/[channelId]', () => {
|
|||||||
cy.intercept(`${API_URL}${getChannelsWithGuildIdHandler.url}*`).as(
|
cy.intercept(`${API_URL}${getChannelsWithGuildIdHandler.url}*`).as(
|
||||||
'getChannelsWithGuildIdHandler'
|
'getChannelsWithGuildIdHandler'
|
||||||
)
|
)
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
|
||||||
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
||||||
cy.wait(['@getChannelsWithGuildIdHandler', '@nextStaticAndImages']).then(
|
cy.wait(['@getChannelsWithGuildIdHandler']).then(() => {
|
||||||
() => {
|
cy.get('.channels-list').children().should('have.length', 2)
|
||||||
cy.get('.channels-list').children().should('have.length', 2)
|
cy.get('.channels-list [data-cy=channel-name]:first').should(
|
||||||
cy.get('.channels-list [data-cy=channel-name]:first').should(
|
'have.text',
|
||||||
'have.text',
|
`# ${channelExample.name}`
|
||||||
`# ${channelExample.name}`
|
)
|
||||||
)
|
cy.get('.channels-list [data-cy=channel-name]:last').should(
|
||||||
cy.get('.channels-list [data-cy=channel-name]:last').should(
|
'have.text',
|
||||||
'have.text',
|
`# ${channelExample2.name}`
|
||||||
`# ${channelExample2.name}`
|
)
|
||||||
)
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should succeeds and display the messages correctly', () => {
|
it('should succeeds and display the messages correctly', () => {
|
||||||
@ -146,11 +141,9 @@ describe('Pages > /application/[guildId]/[channelId]', () => {
|
|||||||
cy.intercept(`${API_URL}${getMessagesUploadsDownloadHandler.url}`).as(
|
cy.intercept(`${API_URL}${getMessagesUploadsDownloadHandler.url}`).as(
|
||||||
'getMessagesUploadsDownloadHandler'
|
'getMessagesUploadsDownloadHandler'
|
||||||
)
|
)
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
|
||||||
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
||||||
cy.wait([
|
cy.wait([
|
||||||
'@getMessagesWithChannelIdHandler',
|
'@getMessagesWithChannelIdHandler',
|
||||||
'@nextStaticAndImages',
|
|
||||||
'@getMessagesUploadsImageHandler',
|
'@getMessagesUploadsImageHandler',
|
||||||
'@getMessagesUploadsAudioHandler',
|
'@getMessagesUploadsAudioHandler',
|
||||||
'@getMessagesUploadsVideoHandler',
|
'@getMessagesUploadsVideoHandler',
|
||||||
@ -226,21 +219,18 @@ describe('Pages > /application/[guildId]/[channelId]', () => {
|
|||||||
cy.intercept(`${API_URL}${getMembersWithGuildIdHandler.url}*`).as(
|
cy.intercept(`${API_URL}${getMembersWithGuildIdHandler.url}*`).as(
|
||||||
'getMembersWithGuildIdHandler'
|
'getMembersWithGuildIdHandler'
|
||||||
)
|
)
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
|
||||||
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
cy.visit(`/application/${guildExample.id}/${channelExample.id}`)
|
||||||
cy.wait(['@getMembersWithGuildIdHandler', '@nextStaticAndImages']).then(
|
cy.wait(['@getMembersWithGuildIdHandler']).then(() => {
|
||||||
() => {
|
cy.get('.members-list').should('not.be.visible')
|
||||||
cy.get('.members-list').should('not.be.visible')
|
cy.get('[data-cy=icon-button-right-sidebar-members]').click()
|
||||||
cy.get('[data-cy=icon-button-right-sidebar-members]').click()
|
cy.get('.members-list').should('be.visible')
|
||||||
cy.get('.members-list').should('be.visible')
|
cy.get('[data-cy=members-title]').should('have.text', 'Member(s)')
|
||||||
cy.get('[data-cy=members-title]').should('have.text', 'Member(s)')
|
cy.get('.members-list').children().should('have.length', 1)
|
||||||
cy.get('.members-list').children().should('have.length', 1)
|
cy.get('.members-list [data-cy=member-user-name]:first').should(
|
||||||
cy.get('.members-list [data-cy=member-user-name]:first').should(
|
'have.text',
|
||||||
'have.text',
|
memberExampleComplete.user.name
|
||||||
memberExampleComplete.user.name
|
)
|
||||||
)
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should redirect the user to `/404` if `guildId` or `channelId` are not numbers', () => {
|
it('should redirect the user to `/404` if `guildId` or `channelId` are not numbers', () => {
|
||||||
|
@ -57,6 +57,7 @@ describe('Pages > /application/[guildId]/[channelId]/settings', () => {
|
|||||||
)
|
)
|
||||||
cy.visit(`/application/${guildExample.id}/${channelExample.id}/settings`)
|
cy.visit(`/application/${guildExample.id}/${channelExample.id}/settings`)
|
||||||
cy.get('[data-cy=button-delete-channel-settings]').click()
|
cy.get('[data-cy=button-delete-channel-settings]').click()
|
||||||
|
cy.get('[data-cy=confirm-popup-yes-button]').click()
|
||||||
cy.wait('@deleteChannelWithChannelIdHandler').then(() => {
|
cy.wait('@deleteChannelWithChannelIdHandler').then(() => {
|
||||||
cy.location('pathname').should(
|
cy.location('pathname').should(
|
||||||
'eq',
|
'eq',
|
||||||
|
@ -69,6 +69,7 @@ describe('Pages > /application/[guildId]/settings', () => {
|
|||||||
)
|
)
|
||||||
cy.visit(`/application/${guildExample.id}/settings`)
|
cy.visit(`/application/${guildExample.id}/settings`)
|
||||||
cy.get('[data-cy=button-delete-guild-settings]').click()
|
cy.get('[data-cy=button-delete-guild-settings]').click()
|
||||||
|
cy.get('[data-cy=confirm-popup-yes-button]').click()
|
||||||
cy.wait('@deleteGuildWithGuildIdHandler').then((interception) => {
|
cy.wait('@deleteGuildWithGuildIdHandler').then((interception) => {
|
||||||
expect(interception.response).to.not.be.eql(undefined)
|
expect(interception.response).to.not.be.eql(undefined)
|
||||||
if (interception.response !== undefined) {
|
if (interception.response !== undefined) {
|
||||||
|
@ -20,9 +20,8 @@ describe('Pages > /application/guilds/join', () => {
|
|||||||
cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as(
|
cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as(
|
||||||
'getGuildsPublicHandler'
|
'getGuildsPublicHandler'
|
||||||
)
|
)
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
|
||||||
cy.visit('/application/guilds/join')
|
cy.visit('/application/guilds/join')
|
||||||
cy.wait(['@getGuildsPublicHandler', '@nextStaticAndImages']).then(() => {
|
cy.wait(['@getGuildsPublicHandler']).then(() => {
|
||||||
cy.get('[data-cy=application-title]').should('have.text', 'Join a Guild')
|
cy.get('[data-cy=application-title]').should('have.text', 'Join a Guild')
|
||||||
cy.get('.guilds-public-list').children().should('have.length', 2)
|
cy.get('.guilds-public-list').children().should('have.length', 2)
|
||||||
cy.get('.guilds-public-list [data-cy=guild-name]:first').should(
|
cy.get('.guilds-public-list [data-cy=guild-name]:first').should(
|
||||||
@ -45,8 +44,7 @@ describe('Pages > /application/guilds/join', () => {
|
|||||||
cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as(
|
cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as(
|
||||||
'getGuildsPublicHandler'
|
'getGuildsPublicHandler'
|
||||||
)
|
)
|
||||||
cy.intercept(`/_next/*`).as('nextStaticAndImages')
|
cy.wait(['@getGuildsPublicHandler']).then(() => {
|
||||||
cy.wait(['@getGuildsPublicHandler', '@nextStaticAndImages']).then(() => {
|
|
||||||
cy.get('[data-cy=search-guild-input]').type(guildExample2.name)
|
cy.get('[data-cy=search-guild-input]').type(guildExample2.name)
|
||||||
cy.get('.guilds-public-list').children().should('have.length', 1)
|
cy.get('.guilds-public-list').children().should('have.length', 1)
|
||||||
cy.get('.guilds-public-list [data-cy=guild-name]:first').should(
|
cy.get('.guilds-public-list [data-cy=guild-name]:first').should(
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
version: '3.0'
|
|
||||||
services:
|
services:
|
||||||
thream-website:
|
thream-website:
|
||||||
container_name: ${COMPOSE_PROJECT_NAME}
|
container_name: ${COMPOSE_PROJECT_NAME}
|
||||||
|
@ -4,7 +4,7 @@ export interface {{ properCase name }}Props {
|
|||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const {{ properCase name }}: React.FC<{{ properCase name }}Props> = (props) => {
|
export const {{ properCase name }}: React.FC<React.PropsWithChildren{{ properCase name }}Props>> = (props) => {
|
||||||
const { children, className } = props
|
const { children, className } = props
|
||||||
|
|
||||||
return <main className={classNames(className, '')}>{children}</main>
|
return <main className={classNames(className, '')}>{children}</main>
|
||||||
|
@ -2,10 +2,16 @@
|
|||||||
"website": "Website",
|
"website": "Website",
|
||||||
"create": "Create",
|
"create": "Create",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
|
"create-a-channel": "Create a channel",
|
||||||
|
"delete-channel-only-one": "The guild should have at least one channel. You can't delete the only channel of the guild.",
|
||||||
"create-a-guild": "Create a Guild",
|
"create-a-guild": "Create a Guild",
|
||||||
"create-a-guild-description": "Create your own guild and manage everything.",
|
"create-a-guild-description": "Create your own guild and manage everything.",
|
||||||
|
"user-settings": "User settings",
|
||||||
|
"guild-settings": "Guild settings",
|
||||||
"join-a-guild": "Join a Guild",
|
"join-a-guild": "Join a Guild",
|
||||||
"join-the-guild": "Join the guild",
|
"join-the-guild": "Join the guild",
|
||||||
|
"delete-the-guild": "Delete the guild",
|
||||||
|
"delete-the-channel": "Delete the channel",
|
||||||
"join-a-guild-description": "Talk, collaborate, share and have fun with your friends by joining an already existing guild!",
|
"join-a-guild-description": "Talk, collaborate, share and have fun with your friends by joining an already existing guild!",
|
||||||
"members": "member(s)",
|
"members": "member(s)",
|
||||||
"search": "Search",
|
"search": "Search",
|
||||||
|
@ -2,10 +2,16 @@
|
|||||||
"website": "Site web",
|
"website": "Site web",
|
||||||
"create": "Créer",
|
"create": "Créer",
|
||||||
"status": "Statut",
|
"status": "Statut",
|
||||||
|
"create-a-channel": "Créer un channel",
|
||||||
|
"delete-channel-only-one": "La guilde doit avoir au moins un channel. Vous ne pouvez pas supprimer le seul channel de la guilde.",
|
||||||
"create-a-guild": "Créer une Guilde",
|
"create-a-guild": "Créer une Guilde",
|
||||||
"create-a-guild-description": "Créez votre propre guilde et gérez tout.",
|
"create-a-guild-description": "Créez votre propre guilde et gérez tout.",
|
||||||
|
"user-settings": "Paramètres utilisateur",
|
||||||
|
"guild-settings": "Paramètres de la guilde",
|
||||||
"join-a-guild": "Rejoindre une Guilde",
|
"join-a-guild": "Rejoindre une Guilde",
|
||||||
"join-the-guild": "Rejoindre la guilde",
|
"join-the-guild": "Rejoindre la guilde",
|
||||||
|
"delete-the-guild": "Supprimer la guilde",
|
||||||
|
"delete-the-channel": "Supprimer le channel",
|
||||||
"join-a-guild-description": "Discutez, collaborez, partagez et amusez-vous avec vos amis en rejoignant une guilde déjà existante!",
|
"join-a-guild-description": "Discutez, collaborez, partagez et amusez-vous avec vos amis en rejoignant une guilde déjà existante!",
|
||||||
"members": "membre(s)",
|
"members": "membre(s)",
|
||||||
"search": "Rechercher",
|
"search": "Rechercher",
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
"all-rights-reserved": "Tous droits réservés",
|
"all-rights-reserved": "Tous droits réservés",
|
||||||
"description": "Restez proche de vos amis et de vos communautés, parlez, collaborez, partagez et amusez-vous.",
|
"description": "Restez proche de vos amis et de vos communautés, parlez, collaborez, partagez et amusez-vous.",
|
||||||
"name": "Nom",
|
"name": "Nom",
|
||||||
"yes": "Yes",
|
"yes": "Oui",
|
||||||
"no": "Non"
|
"no": "Non"
|
||||||
}
|
}
|
||||||
|
14076
package-lock.json
generated
14076
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
88
package.json
88
package.json
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@thream/website",
|
"name": "@thream/website",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Thream/website"
|
"url": "https://github.com/Thream/website"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0",
|
"node": ">=16.0.0",
|
||||||
"npm": ">=7.0.0"
|
"npm": ">=8.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@ -23,7 +23,6 @@
|
|||||||
"lint:prettier": "prettier \".\" --check",
|
"lint:prettier": "prettier \".\" --check",
|
||||||
"lint:staged": "lint-staged",
|
"lint:staged": "lint-staged",
|
||||||
"test:unit": "jest",
|
"test:unit": "jest",
|
||||||
"test:html-w3c-validator": "start-server-and-test \"start\" \"http://localhost:3000\" \"html-w3c-validator\"",
|
|
||||||
"test:lighthouse": "lhci autorun",
|
"test:lighthouse": "lhci autorun",
|
||||||
"test:e2e": "start-server-and-test \"start\" \"http://localhost:3000\" \"cypress run\"",
|
"test:e2e": "start-server-and-test \"start\" \"http://localhost:3000\" \"cypress run\"",
|
||||||
"test:e2e:dev": "start-server-and-test \"dev\" \"http://localhost:3000\" \"cypress open\"",
|
"test:e2e:dev": "start-server-and-test \"dev\" \"http://localhost:3000\" \"cypress open\"",
|
||||||
@ -32,86 +31,87 @@
|
|||||||
"postinstall": "husky install"
|
"postinstall": "husky install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/montserrat": "4.5.7",
|
"@fontsource/montserrat": "4.5.11",
|
||||||
"@fontsource/roboto": "4.5.5",
|
"@fontsource/roboto": "4.5.7",
|
||||||
"@heroicons/react": "1.0.6",
|
"@heroicons/react": "1.0.6",
|
||||||
"@sinclair/typebox": "0.23.4",
|
"@sinclair/typebox": "0.23.5",
|
||||||
"ajv": "8.11.0",
|
"ajv": "8.11.0",
|
||||||
"ajv-formats": "2.1.1",
|
"ajv-formats": "2.1.1",
|
||||||
"axios": "0.26.1",
|
"axios": "0.26.1",
|
||||||
"classnames": "2.3.1",
|
"classnames": "2.3.1",
|
||||||
"date-and-time": "2.3.0",
|
"date-and-time": "2.4.0",
|
||||||
"emoji-mart": "3.0.1",
|
"emoji-mart": "3.0.1",
|
||||||
"katex": "0.15.3",
|
"katex": "0.16.0",
|
||||||
"next": "12.1.4",
|
"next": "12.2.0",
|
||||||
"next-pwa": "5.4.7",
|
"next-pwa": "5.5.4",
|
||||||
"next-themes": "0.1.1",
|
"next-themes": "0.2.0",
|
||||||
"next-translate": "1.3.5",
|
"next-translate": "1.4.0",
|
||||||
"pretty-bytes": "6.0.0",
|
"pretty-bytes": "6.0.0",
|
||||||
"react": "17.0.2",
|
"react": "18.2.0",
|
||||||
"react-component-form": "3.0.1",
|
"react-component-form": "3.0.1",
|
||||||
"react-dom": "17.0.2",
|
"react-dom": "18.2.0",
|
||||||
"react-infinite-scroll-component": "6.1.0",
|
"react-infinite-scroll-component": "6.1.0",
|
||||||
"react-markdown": "8.0.2",
|
"react-markdown": "8.0.3",
|
||||||
"react-responsive": "8.2.0",
|
"react-responsive": "8.2.0",
|
||||||
"react-swipeable": "6.2.1",
|
"react-swipeable": "7.0.0",
|
||||||
"react-textarea-autosize": "8.3.3",
|
"react-syntax-highlighter": "15.5.0",
|
||||||
|
"react-textarea-autosize": "8.3.4",
|
||||||
"read-pkg": "7.1.0",
|
"read-pkg": "7.1.0",
|
||||||
"rehype-katex": "6.0.2",
|
"rehype-katex": "6.0.2",
|
||||||
"remark-breaks": "3.0.2",
|
"remark-breaks": "3.0.2",
|
||||||
"remark-gfm": "3.0.1",
|
"remark-gfm": "3.0.1",
|
||||||
"remark-math": "5.1.1",
|
"remark-math": "5.1.1",
|
||||||
"sharp": "0.30.3",
|
"sharp": "0.30.7",
|
||||||
"socket.io-client": "4.4.1",
|
"socket.io-client": "4.5.1",
|
||||||
"unified": "10.1.2",
|
"unified": "10.1.2",
|
||||||
"unist-util-visit": "4.1.0",
|
"unist-util-visit": "4.1.0",
|
||||||
"universal-cookie": "4.0.4"
|
"universal-cookie": "4.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "16.2.3",
|
"@commitlint/cli": "17.0.3",
|
||||||
"@commitlint/config-conventional": "16.2.1",
|
"@commitlint/config-conventional": "17.0.3",
|
||||||
"@lhci/cli": "0.9.0",
|
"@lhci/cli": "0.9.0",
|
||||||
"@saithodev/semantic-release-backmerge": "2.1.2",
|
"@saithodev/semantic-release-backmerge": "2.1.2",
|
||||||
"@semantic-release/git": "10.0.1",
|
"@semantic-release/git": "10.0.1",
|
||||||
"@testing-library/jest-dom": "5.16.4",
|
"@testing-library/jest-dom": "5.16.4",
|
||||||
"@testing-library/react": "12.1.4",
|
"@testing-library/react": "13.3.0",
|
||||||
"@types/emoji-mart": "3.0.9",
|
"@types/emoji-mart": "3.0.9",
|
||||||
"@types/hast": "2.3.4",
|
"@types/hast": "2.3.4",
|
||||||
"@types/jest": "27.4.1",
|
"@types/jest": "27.5.1",
|
||||||
"@types/katex": "0.14.0",
|
"@types/katex": "0.14.0",
|
||||||
"@types/node": "17.0.23",
|
"@types/node": "18.0.0",
|
||||||
"@types/react": "17.0.43",
|
"@types/react": "18.0.14",
|
||||||
"@types/react-responsive": "8.0.5",
|
"@types/react-responsive": "8.0.5",
|
||||||
|
"@types/react-syntax-highlighter": "15.5.2",
|
||||||
"@types/unist": "2.0.6",
|
"@types/unist": "2.0.6",
|
||||||
"@typescript-eslint/eslint-plugin": "5.18.0",
|
"@typescript-eslint/eslint-plugin": "5.30.0",
|
||||||
"@typescript-eslint/parser": "5.18.0",
|
"@typescript-eslint/parser": "5.30.0",
|
||||||
"autoprefixer": "10.4.4",
|
"autoprefixer": "10.4.7",
|
||||||
"cypress": "9.5.3",
|
"cypress": "9.6.1",
|
||||||
"editorconfig-checker": "4.0.2",
|
"editorconfig-checker": "4.0.2",
|
||||||
"eslint": "8.12.0",
|
"eslint": "8.18.0",
|
||||||
"eslint-config-conventions": "2.0.0",
|
"eslint-config-conventions": "2.0.0",
|
||||||
"eslint-config-next": "12.1.4",
|
"eslint-config-next": "12.2.0",
|
||||||
"eslint-config-prettier": "8.5.0",
|
"eslint-config-prettier": "8.5.0",
|
||||||
"eslint-plugin-import": "2.26.0",
|
"eslint-plugin-import": "2.26.0",
|
||||||
"eslint-plugin-prettier": "4.0.0",
|
"eslint-plugin-prettier": "4.1.0",
|
||||||
"eslint-plugin-promise": "6.0.0",
|
"eslint-plugin-promise": "6.0.0",
|
||||||
"eslint-plugin-unicorn": "42.0.0",
|
"eslint-plugin-unicorn": "42.0.0",
|
||||||
"html-w3c-validator": "1.2.0",
|
"husky": "8.0.1",
|
||||||
"husky": "7.0.4",
|
|
||||||
"jest": "27.5.1",
|
"jest": "27.5.1",
|
||||||
"lint-staged": "12.3.7",
|
"lint-staged": "13.0.3",
|
||||||
"markdownlint-cli": "0.31.1",
|
"markdownlint-cli": "0.31.1",
|
||||||
"mockttp": "2.7.0",
|
"mockttp": "2.7.0",
|
||||||
"next-secure-headers": "2.2.0",
|
"next-secure-headers": "2.2.0",
|
||||||
"plop": "3.0.5",
|
"plop": "3.1.1",
|
||||||
"postcss": "8.4.12",
|
"postcss": "8.4.14",
|
||||||
"prettier": "2.6.2",
|
"prettier": "2.7.1",
|
||||||
"prettier-plugin-tailwindcss": "0.1.8",
|
"prettier-plugin-tailwindcss": "0.1.11",
|
||||||
"semantic-release": "19.0.2",
|
"semantic-release": "19.0.3",
|
||||||
"serve": "13.0.2",
|
"serve": "13.0.2",
|
||||||
"start-server-and-test": "1.14.0",
|
"start-server-and-test": "1.14.0",
|
||||||
"tailwindcss": "3.0.23",
|
"tailwindcss": "3.1.4",
|
||||||
"typescript": "4.6.3",
|
"typescript": "4.7.4",
|
||||||
"vercel": "24.0.1"
|
"vercel": "25.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ const ChannelPage: NextPage<ChannelPageProps> = (props) => {
|
|||||||
<MembersProviders path={path}>
|
<MembersProviders path={path}>
|
||||||
<ChannelsProvider path={path}>
|
<ChannelsProvider path={path}>
|
||||||
<MessagesProvider path={path}>
|
<MessagesProvider path={path}>
|
||||||
<Head title='Thream | Application' />
|
<Head title={`Thream | ${selectedChannel.name}`} />
|
||||||
<Application
|
<Application
|
||||||
path={path}
|
path={path}
|
||||||
guildLeftSidebar={<GuildLeftSidebar path={path} />}
|
guildLeftSidebar={<GuildLeftSidebar path={path} />}
|
||||||
|
@ -40,7 +40,7 @@ const ChannelSettingsPage: NextPage<ChannelSettingsPageProps> = (props) => {
|
|||||||
<GuildMemberProvider guildMember={guildMember} path={path}>
|
<GuildMemberProvider guildMember={guildMember} path={path}>
|
||||||
<MembersProviders path={path}>
|
<MembersProviders path={path}>
|
||||||
<ChannelsProvider path={path}>
|
<ChannelsProvider path={path}>
|
||||||
<Head title='Thream | Application' />
|
<Head title={`Thream | ${selectedChannel.name}`} />
|
||||||
<Application
|
<Application
|
||||||
path={path}
|
path={path}
|
||||||
guildLeftSidebar={<GuildLeftSidebar path={path} />}
|
guildLeftSidebar={<GuildLeftSidebar path={path} />}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { NextPage } from 'next'
|
import { NextPage } from 'next'
|
||||||
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
|
||||||
import { Head } from '../../../../components/Head'
|
import { Head } from '../../../../components/Head'
|
||||||
import { Application } from '../../../../components/Application'
|
import { Application } from '../../../../components/Application'
|
||||||
@ -21,6 +22,7 @@ export interface CreateChannelPageProps extends PagePropsWithAuthentication {
|
|||||||
|
|
||||||
const CreateChannelPage: NextPage<CreateChannelPageProps> = (props) => {
|
const CreateChannelPage: NextPage<CreateChannelPageProps> = (props) => {
|
||||||
const { guildId, authentication, guildMember } = props
|
const { guildId, authentication, guildMember } = props
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const path = { guildId }
|
const path = { guildId }
|
||||||
|
|
||||||
@ -29,10 +31,10 @@ const CreateChannelPage: NextPage<CreateChannelPageProps> = (props) => {
|
|||||||
<GuildsProvider>
|
<GuildsProvider>
|
||||||
<GuildMemberProvider guildMember={guildMember} path={path}>
|
<GuildMemberProvider guildMember={guildMember} path={path}>
|
||||||
<Head
|
<Head
|
||||||
title={`Thream | Crée un channel`}
|
title={`Thream | ${t('application:create-a-channel')}`}
|
||||||
description={'Crée un nouveau channel'}
|
description={t('application:create-a-channel')}
|
||||||
/>
|
/>
|
||||||
<Application path={path} title={'Crée un channel'}>
|
<Application path={path} title={t('application:create-a-channel')}>
|
||||||
<CreateChannel />
|
<CreateChannel />
|
||||||
</Application>
|
</Application>
|
||||||
</GuildMemberProvider>
|
</GuildMemberProvider>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { NextPage } from 'next'
|
import { NextPage } from 'next'
|
||||||
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
|
||||||
import { Head } from '../../../components/Head'
|
import { Head } from '../../../components/Head'
|
||||||
import { Application } from '../../../components/Application'
|
import { Application } from '../../../components/Application'
|
||||||
@ -18,6 +19,7 @@ export interface GuildSettingsPageProps extends PagePropsWithAuthentication {
|
|||||||
|
|
||||||
const GuildSettingsPage: NextPage<GuildSettingsPageProps> = (props) => {
|
const GuildSettingsPage: NextPage<GuildSettingsPageProps> = (props) => {
|
||||||
const { guildId, authentication, guildMember } = props
|
const { guildId, authentication, guildMember } = props
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const path = { guildId }
|
const path = { guildId }
|
||||||
|
|
||||||
@ -25,8 +27,8 @@ const GuildSettingsPage: NextPage<GuildSettingsPageProps> = (props) => {
|
|||||||
<AuthenticationProvider authentication={authentication}>
|
<AuthenticationProvider authentication={authentication}>
|
||||||
<GuildsProvider>
|
<GuildsProvider>
|
||||||
<GuildMemberProvider guildMember={guildMember} path={path}>
|
<GuildMemberProvider guildMember={guildMember} path={path}>
|
||||||
<Head title='Thream | Guild settings' />
|
<Head title={`Thream | ${t('application:guild-settings')}`} />
|
||||||
<Application path={path} title='Guild settings'>
|
<Application path={path} title={t('application:guild-settings')}>
|
||||||
<GuildSettings />
|
<GuildSettings />
|
||||||
</Application>
|
</Application>
|
||||||
</GuildMemberProvider>
|
</GuildMemberProvider>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { NextPage } from 'next'
|
import { NextPage } from 'next'
|
||||||
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
|
||||||
import { Head } from '../../../components/Head'
|
import { Head } from '../../../components/Head'
|
||||||
import { Application } from '../../../components/Application'
|
import { Application } from '../../../components/Application'
|
||||||
@ -11,11 +12,16 @@ import { UserSettings } from '../../../components/Application/UserSettings'
|
|||||||
import { GuildsProvider } from '../../../contexts/Guilds'
|
import { GuildsProvider } from '../../../contexts/Guilds'
|
||||||
|
|
||||||
const UserSettingsPage: NextPage<PagePropsWithAuthentication> = (props) => {
|
const UserSettingsPage: NextPage<PagePropsWithAuthentication> = (props) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthenticationProvider authentication={props.authentication}>
|
<AuthenticationProvider authentication={props.authentication}>
|
||||||
<GuildsProvider>
|
<GuildsProvider>
|
||||||
<Head title='Thream | Settings' />
|
<Head title={`Thream | ${t('application:user-settings')}`} />
|
||||||
<Application path={`/application/users/settings`} title='Settings'>
|
<Application
|
||||||
|
path='/application/users/settings'
|
||||||
|
title={t('application:user-settings')}
|
||||||
|
>
|
||||||
<UserSettings />
|
<UserSettings />
|
||||||
</Application>
|
</Application>
|
||||||
</GuildsProvider>
|
</GuildsProvider>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
export const API_VERSION = '1.0.0'
|
export const API_VERSION = '1.1.0'
|
||||||
|
|
||||||
export const API_DEFAULT_PORT = 8080
|
export const API_DEFAULT_PORT = 8080
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import useTranslation from 'next-translate/useTranslation'
|
|||||||
|
|
||||||
import { Authentication, PagePropsWithAuthentication } from '.'
|
import { Authentication, PagePropsWithAuthentication } from '.'
|
||||||
import { UserCurrent } from '../../models/User'
|
import { UserCurrent } from '../../models/User'
|
||||||
import { Language, Theme } from '../../models/UserSettings'
|
|
||||||
|
|
||||||
export interface AuthenticationValue {
|
export interface AuthenticationValue {
|
||||||
authentication: Authentication
|
authentication: Authentication
|
||||||
@ -18,9 +17,9 @@ const AuthenticationContext = createContext<AuthenticationValue>(
|
|||||||
defaultAuthenticationContext
|
defaultAuthenticationContext
|
||||||
)
|
)
|
||||||
|
|
||||||
export const AuthenticationProvider: React.FC<PagePropsWithAuthentication> = (
|
export const AuthenticationProvider: React.FC<
|
||||||
props
|
React.PropsWithChildren<PagePropsWithAuthentication>
|
||||||
) => {
|
> = (props) => {
|
||||||
const { lang } = useTranslation()
|
const { lang } = useTranslation()
|
||||||
const { theme, setTheme } = useTheme()
|
const { theme, setTheme } = useTheme()
|
||||||
const [user, setUser] = useState<UserCurrent>(props.authentication.user)
|
const [user, setUser] = useState<UserCurrent>(props.authentication.user)
|
||||||
@ -41,14 +40,13 @@ export const AuthenticationProvider: React.FC<PagePropsWithAuthentication> = (
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
authentication.api
|
authentication.api
|
||||||
.put('/users/current/settings', { theme, language: lang })
|
.put('/users/current/settings', { theme, language: lang })
|
||||||
.then(() => {
|
.then(({ data: userCurrentSettings }) => {
|
||||||
setUser((oldUser) => {
|
setUser((oldUser) => {
|
||||||
return {
|
return {
|
||||||
...oldUser,
|
...oldUser,
|
||||||
settings: {
|
settings: {
|
||||||
...oldUser.settings,
|
...oldUser.settings,
|
||||||
theme: theme as Theme,
|
...userCurrentSettings.settings
|
||||||
language: lang as Language
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user