diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 727b3a2..7ec0792 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -1,9 +1,9 @@ services: workspace: build: - context: './' - dockerfile: './Dockerfile' + context: "./" + dockerfile: "./Dockerfile" volumes: - - '..:/workspace:cached' - command: 'sleep infinity' - network_mode: 'host' + - "..:/workspace:cached" + command: "sleep infinity" + network_mode: "host" diff --git a/.github/ISSUE_TEMPLATE/BUG.md b/.github/ISSUE_TEMPLATE/BUG.md index e1fc7e7..d47b126 100644 --- a/.github/ISSUE_TEMPLATE/BUG.md +++ b/.github/ISSUE_TEMPLATE/BUG.md @@ -1,8 +1,8 @@ --- -name: '🐛 Bug Report' -about: 'Report an unexpected problem or unintended behavior.' -title: '[Bug]' -labels: 'bug' +name: "🐛 Bug Report" +about: "Report an unexpected problem or unintended behavior." +title: "[Bug]" +labels: "bug" --- diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md index 3307418..dc9a49c 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -1,8 +1,8 @@ --- -name: '✨ Feature Request' -about: 'Suggest a new feature idea.' -title: '[Feature]' -labels: 'feature request' +name: "✨ Feature Request" +about: "Suggest a new feature idea." +title: "[Feature]" +labels: "feature request" --- diff --git a/.github/ISSUE_TEMPLATE/IMPROVEMENT.md b/.github/ISSUE_TEMPLATE/IMPROVEMENT.md index b5bdbb7..e50e289 100644 --- a/.github/ISSUE_TEMPLATE/IMPROVEMENT.md +++ b/.github/ISSUE_TEMPLATE/IMPROVEMENT.md @@ -1,8 +1,8 @@ --- -name: '🔧 Improvement' -about: 'Improve structure/format/performance/refactor/tests of the code.' -title: '[Improvement]' -labels: 'improvement' +name: "🔧 Improvement" +about: "Improve structure/format/performance/refactor/tests of the code." +title: "[Improvement]" +labels: "improvement" --- diff --git a/.github/ISSUE_TEMPLATE/QUESTION.md b/.github/ISSUE_TEMPLATE/QUESTION.md index c18eaa3..df6acdc 100644 --- a/.github/ISSUE_TEMPLATE/QUESTION.md +++ b/.github/ISSUE_TEMPLATE/QUESTION.md @@ -1,8 +1,8 @@ --- -name: '🙋 Question' -about: 'Further information is requested.' -title: '[Question]' -labels: 'question' +name: "🙋 Question" +about: "Further information is requested." +title: "[Question]" +labels: "question" --- ### Question diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 21bc1b7..a2e339f 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -1,4 +1,4 @@ -name: 'Analyze' +name: "Analyze" on: push: @@ -8,20 +8,20 @@ on: jobs: analyze: - runs-on: 'ubuntu-latest' + runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: - language: ['javascript'] + language: ["javascript"] steps: - - uses: 'actions/checkout@v4.0.0' + - uses: "actions/checkout@v4.0.0" - - name: 'Initialize CodeQL' - uses: 'github/codeql-action/init@v2' + - name: "Initialize CodeQL" + uses: "github/codeql-action/init@v2" with: languages: ${{ matrix.language }} - - name: 'Perform CodeQL Analysis' - uses: 'github/codeql-action/analyze@v2' + - name: "Perform CodeQL Analysis" + uses: "github/codeql-action/analyze@v2" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 044f75d..855162b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: 'Build' +name: "Build" on: push: @@ -8,18 +8,18 @@ on: jobs: build: - runs-on: 'ubuntu-latest' + runs-on: "ubuntu-latest" steps: - - uses: 'actions/checkout@v4.0.0' + - uses: "actions/checkout@v4.0.0" - - name: 'Setup Node.js' - uses: 'actions/setup-node@v3.8.1' + - name: "Setup Node.js" + uses: "actions/setup-node@v3.8.1" with: - node-version: '20.x' - cache: 'npm' + node-version: "20.x" + cache: "npm" - - name: 'Install dependencies' - run: 'npm clean-install' + - name: "Install dependencies" + run: "npm clean-install" - - name: 'Build' - run: 'npm run build' + - name: "Build" + run: "npm run build" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 82c680e..50c0363 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: 'Lint' +name: "Lint" on: push: @@ -8,30 +8,30 @@ on: jobs: lint: - runs-on: 'ubuntu-latest' + runs-on: "ubuntu-latest" steps: - - uses: 'actions/checkout@v4.0.0' + - uses: "actions/checkout@v4.0.0" - - name: 'Setup Node.js' - uses: 'actions/setup-node@v3.8.1' + - name: "Setup Node.js" + uses: "actions/setup-node@v3.8.1" with: - node-version: '20.x' - cache: 'npm' + node-version: "20.x" + cache: "npm" - - name: 'Install dependencies' - run: 'npm clean-install' + - name: "Install dependencies" + run: "npm clean-install" - - name: 'lint:commit' + - name: "lint:commit" run: 'npm run lint:commit -- --to "${{ github.sha }}"' - - name: 'lint:editorconfig' - run: 'npm run lint:editorconfig' + - name: "lint:editorconfig" + run: "npm run lint:editorconfig" - - name: 'lint:markdown' - run: 'npm run lint:markdown' + - name: "lint:markdown" + run: "npm run lint:markdown" - - name: 'lint:eslint' - run: 'npm run lint:eslint' + - name: "lint:eslint" + run: "npm run lint:eslint" - - name: 'lint:prettier' - run: 'npm run lint:prettier' + - name: "lint:prettier" + run: "npm run lint:prettier" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bfa4537..fe1aa96 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: 'Release' +name: "Release" on: push: @@ -6,31 +6,31 @@ on: jobs: release: - runs-on: 'ubuntu-latest' + runs-on: "ubuntu-latest" steps: - - uses: 'actions/checkout@v4.0.0' + - uses: "actions/checkout@v4.0.0" with: fetch-depth: 0 persist-credentials: false - - name: 'Import GPG key' - uses: 'crazy-max/ghaction-import-gpg@v6.0.0' + - name: "Import GPG key" + uses: "crazy-max/ghaction-import-gpg@v6.0.0" with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} git_user_signingkey: true git_commit_gpgsign: true - - name: 'Setup Node.js' - uses: 'actions/setup-node@v3.8.1' + - name: "Setup Node.js" + uses: "actions/setup-node@v3.8.1" with: - node-version: '20.x' - cache: 'npm' + node-version: "20.x" + cache: "npm" - - name: 'Install dependencies' - run: 'npm clean-install' + - name: "Install dependencies" + run: "npm clean-install" - - name: 'Release' - run: 'npm run release' + - name: "Release" + run: "npm run release" env: GH_TOKEN: ${{ secrets.GH_TOKEN }} GIT_COMMITTER_NAME: ${{ secrets.GIT_NAME }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82d54c7..7635655 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: 'Test' +name: "Test" on: push: @@ -8,41 +8,41 @@ on: jobs: test-unit: - runs-on: 'ubuntu-latest' + runs-on: "ubuntu-latest" steps: - - uses: 'actions/checkout@v4.0.0' + - uses: "actions/checkout@v4.0.0" - - name: 'Setup Node.js' - uses: 'actions/setup-node@v3.8.1' + - name: "Setup Node.js" + uses: "actions/setup-node@v3.8.1" with: - node-version: '20.x' - cache: 'npm' + node-version: "20.x" + cache: "npm" - - name: 'Install dependencies' - run: 'npm clean-install' + - name: "Install dependencies" + run: "npm clean-install" - - name: 'Unit Test' - run: 'npm run test:unit' + - name: "Unit Test" + run: "npm run test:unit" test-e2e: - runs-on: 'ubuntu-latest' + runs-on: "ubuntu-latest" steps: - - uses: 'actions/checkout@v4.0.0' + - uses: "actions/checkout@v4.0.0" - - name: 'Setup Node.js' - uses: 'actions/setup-node@v3.8.1' + - name: "Setup Node.js" + uses: "actions/setup-node@v3.8.1" with: - node-version: '20.x' - cache: 'npm' + node-version: "20.x" + cache: "npm" - - name: 'Install dependencies' - run: 'npm clean-install' + - name: "Install dependencies" + run: "npm clean-install" - - name: 'Build' - run: 'npm run build' + - name: "Build" + run: "npm run build" - - name: 'html-w3c-validator' - run: 'npm run test:html-w3c-validator' + - name: "html-w3c-validator" + run: "npm run test:html-w3c-validator" - - name: 'End To End (e2e) Test' - run: 'npm run test:e2e' + - name: "End To End (e2e) Test" + run: "npm run test:e2e" diff --git a/.prettierrc.json b/.prettierrc.json index 83ef1ce..cce9d3c 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,6 +1,3 @@ { - "singleQuote": true, - "jsxSingleQuote": true, - "semi": false, - "trailingComma": "none" + "semi": false } diff --git a/Dockerfile b/Dockerfile index 7858a45..84b843b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -FROM node:20.6.1 AS builder-dependencies +FROM node:20.9.0 AS builder-dependencies WORKDIR /usr/src/application COPY ./.npmrc ./ COPY ./package*.json ./ RUN npm clean-install -FROM node:20.6.1 AS builder +FROM node:20.9.0 AS builder WORKDIR /usr/src/application COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules COPY ./ ./ RUN npm run build -FROM gcr.io/distroless/nodejs20-debian11:latest AS runner +FROM gcr.io/distroless/nodejs20-debian12:latest AS runner WORKDIR /usr/src/application ENV NODE_ENV=production ENV HOSTNAME=0.0.0.0 diff --git a/components/Application/Application.tsx b/components/Application/Application.tsx index 30f4897..7ef5d86 100644 --- a/components/Application/Application.tsx +++ b/components/Application/Application.tsx @@ -1,18 +1,18 @@ -import { useState, useEffect } from 'react' -import Image from 'next/image' -import { PlusIcon, MenuIcon, UsersIcon, XIcon } from '@heroicons/react/solid' -import classNames from 'clsx' -import { useMediaQuery } from 'react-responsive' -import { useSwipeable } from 'react-swipeable' +import { useState, useEffect } from "react" +import Image from "next/image" +import { PlusIcon, MenuIcon, UsersIcon, XIcon } from "@heroicons/react/solid" +import classNames from "clsx" +import { useMediaQuery } from "react-responsive" +import { useSwipeable } from "react-swipeable" -import type { DirectionSidebar } from './Sidebar' -import { Sidebar } from './Sidebar' -import { IconButton } from '../design/IconButton' -import { IconLink } from '../design/IconLink' -import { Guilds } from './Guilds/Guilds' -import { Divider } from '../design/Divider' -import { Members } from './Members' -import { useAuthentication } from '../../tools/authentication' +import type { DirectionSidebar } from "./Sidebar" +import { Sidebar } from "./Sidebar" +import { IconButton } from "../design/IconButton" +import { IconLink } from "../design/IconLink" +import { Guilds } from "./Guilds/Guilds" +import { Divider } from "../design/Divider" +import { Members } from "./Members" +import { useAuthentication } from "../../tools/authentication" export interface ChannelsPath { channelId: number @@ -27,9 +27,9 @@ const isGuildsChannelsPath = (path: any): path is GuildsChannelsPath => { } export type ApplicationPath = - | '/application' - | '/application/guilds/join' - | '/application/guilds/create' + | "/application" + | "/application/guilds/join" + | "/application/guilds/create" | `/application/users/${number}` | `/application/users/settings` | GuildsChannelsPath @@ -51,51 +51,51 @@ export const Application: React.FC< const [mounted, setMounted] = useState(false) const isMobile = useMediaQuery({ - query: '(max-width: 900px)' + query: "(max-width: 900px)", }) const [visibleSidebars, setVisibleSidebars] = useState({ left: !isMobile, - right: false + right: false, }) const handleToggleSidebars = (direction: DirectionSidebar): void => { if (!isMobile) { - if (direction === 'left') { + if (direction === "left") { return setVisibleSidebars({ ...visibleSidebars, - left: !visibleSidebars.left + left: !visibleSidebars.left, }) } - if (direction === 'right') { + if (direction === "right") { return setVisibleSidebars({ ...visibleSidebars, - right: !visibleSidebars.right + right: !visibleSidebars.right, }) } } else { - if (direction === 'right' && visibleSidebars.left) { + if (direction === "right" && visibleSidebars.left) { return setVisibleSidebars({ left: false, - right: true + right: true, }) } - if (direction === 'left' && visibleSidebars.right) { + if (direction === "left" && visibleSidebars.right) { return setVisibleSidebars({ left: true, - right: false + right: false, }) } - if (direction === 'left' && !visibleSidebars.right) { + if (direction === "left" && !visibleSidebars.right) { return setVisibleSidebars({ ...visibleSidebars, - left: !visibleSidebars.left + left: !visibleSidebars.left, }) } - if (direction === 'right' && !visibleSidebars.left) { + if (direction === "right" && !visibleSidebars.left) { return setVisibleSidebars({ ...visibleSidebars, - right: !visibleSidebars.right + right: !visibleSidebars.right, }) } } @@ -105,7 +105,7 @@ export const Application: React.FC< if (isMobile && (visibleSidebars.left || visibleSidebars.right)) { return setVisibleSidebars({ left: false, - right: false + right: false, }) } } @@ -120,7 +120,7 @@ export const Application: React.FC< } setVisibleSidebars({ ...visibleSidebars, - left: true + left: true, }) }, onSwipedLeft: () => { @@ -130,10 +130,10 @@ export const Application: React.FC< } setVisibleSidebars({ ...visibleSidebars, - right: true + right: true, }) } - } + }, }) useEffect(() => { @@ -146,28 +146,28 @@ export const Application: React.FC< return ( <> -
+
{ - return handleToggleSidebars('left') + return handleToggleSidebars("left") }} > {!visibleSidebars.left ? : }
{title}
-
- {title.startsWith('#') && ( +
+ {title.startsWith("#") && ( { - return handleToggleSidebars('right') + return handleToggleSidebars("right") }} > {!visibleSidebars.right ? : } @@ -177,26 +177,26 @@ export const Application: React.FC<
-
+
{"Users's - + @@ -219,14 +219,14 @@ export const Application: React.FC<
{children} @@ -234,7 +234,7 @@ export const Application: React.FC< {isGuildsChannelsPath(path) && ( diff --git a/components/Application/ChannelSettings/ChannelSettings.tsx b/components/Application/ChannelSettings/ChannelSettings.tsx index 6d24694..a22c224 100644 --- a/components/Application/ChannelSettings/ChannelSettings.tsx +++ b/components/Application/ChannelSettings/ChannelSettings.tsx @@ -1,26 +1,26 @@ -import { useRouter } from 'next/router' -import { useState } from 'react' -import { Form, useForm } from 'react-component-form' -import useTranslation from 'next-translate/useTranslation' -import classNames from 'clsx' -import axios from 'axios' -import type { HandleUseFormCallback } from 'react-component-form' +import { useRouter } from "next/router" +import { useState } from "react" +import { Form, useForm } from "react-component-form" +import useTranslation from "next-translate/useTranslation" +import classNames from "clsx" +import axios from "axios" +import type { HandleUseFormCallback } from "react-component-form" -import { FormState } from '../../design/FormState' -import { useGuildMember } from '../../../contexts/GuildMember' -import { Input } from '../../design/Input' -import { Button } from '../../design/Button' -import { useAuthentication } from '../../../tools/authentication' +import { FormState } from "../../design/FormState" +import { useGuildMember } from "../../../contexts/GuildMember" +import { Input } from "../../design/Input" +import { Button } from "../../design/Button" +import { useAuthentication } from "../../../tools/authentication" import type { Channel, - ChannelWithDefaultChannelId -} from '../../../models/Channel' -import { channelSchema } from '../../../models/Channel' -import { ConfirmPopup } from '../ConfirmPopup' -import { useFormTranslation } from '../../../hooks/useFormTranslation' + ChannelWithDefaultChannelId, +} from "../../../models/Channel" +import { channelSchema } from "../../../models/Channel" +import { ConfirmPopup } from "../ConfirmPopup" +import { useFormTranslation } from "../../../hooks/useFormTranslation" const schema = { - name: channelSchema.name + name: channelSchema.name, } export interface ChannelSettingsProps { @@ -36,7 +36,7 @@ export const ChannelSettings: React.FC = (props) => { const { channel } = props const [inputValues, setInputValues] = useState({ - name: channel.name + name: channel.name, }) const [confirmation, setConfirmation] = useState(false) @@ -51,7 +51,7 @@ export const ChannelSettings: React.FC = (props) => { message, errors, setFetchState, - setMessage + setMessage, } = useForm(schema) const { getFirstErrorTranslation } = useFormTranslation() @@ -63,8 +63,8 @@ export const ChannelSettings: React.FC = (props) => { return null } catch (error) { return { - type: 'error', - message: 'errors:server-error' + type: "error", + message: "errors:server-error", } } } @@ -75,7 +75,7 @@ export const ChannelSettings: React.FC = (props) => { setInputValues((oldInputValues) => { return { ...oldInputValues, - [event.target.name]: event.target.value + [event.target.name]: event.target.value, } }) } @@ -84,15 +84,15 @@ export const ChannelSettings: React.FC = (props) => { try { const { data } = await authentication.api.delete( - `/channels/${channel.id}` + `/channels/${channel.id}`, ) await router.push(`/application/${guild.id}/${data.defaultChannelId}`) } catch (error) { - setFetchState('error') + setFetchState("error") if (axios.isAxiosError(error) && error.response?.status === 400) { - setMessage('application:delete-channel-only-one') + setMessage("application:delete-channel-only-one") } else { - setMessage('errors:server-error') + setMessage("errors:server-error") } } } @@ -101,37 +101,37 @@ export const ChannelSettings: React.FC = (props) => { <>
-
-
-
+
+
+
-
-
-
@@ -139,17 +139,17 @@ export const ChannelSettings: React.FC = (props) => {
diff --git a/components/Application/ChannelSettings/index.ts b/components/Application/ChannelSettings/index.ts index 8bfe23a..105d5ef 100644 --- a/components/Application/ChannelSettings/index.ts +++ b/components/Application/ChannelSettings/index.ts @@ -1 +1 @@ -export * from './ChannelSettings' +export * from "./ChannelSettings" diff --git a/components/Application/Channels/Channel.tsx b/components/Application/Channels/Channel.tsx index c31b3d2..331c2d4 100644 --- a/components/Application/Channels/Channel.tsx +++ b/components/Application/Channels/Channel.tsx @@ -1,13 +1,13 @@ -import { memo } from 'react' -import classNames from 'clsx' -import Link from 'next/link' -import { useRouter } from 'next/router' -import { CogIcon } from '@heroicons/react/solid' +import { memo } from "react" +import classNames from "clsx" +import Link from "next/link" +import { useRouter } from "next/router" +import { CogIcon } from "@heroicons/react/solid" -import type { GuildsChannelsPath } from '../Application' -import type { Channel as ChannelType } from '../../../models/Channel' -import { useGuildMember } from '../../../contexts/GuildMember' -import { IconButton } from '../../design/IconButton' +import type { GuildsChannelsPath } from "../Application" +import type { Channel as ChannelType } from "../../../models/Channel" +import { useGuildMember } from "../../../contexts/GuildMember" +import { IconButton } from "../../design/IconButton" export interface ChannelProps { path: GuildsChannelsPath @@ -25,24 +25,24 @@ const ChannelMemo: React.FC = (props) => { - + # {channel.name} {member.isOwner && ( { await router.push( - `/application/${channel.guildId}/${channel.id}/settings` + `/application/${channel.guildId}/${channel.id}/settings`, ) }} - className='bg-unherit absolute -right-10 h-full w-8 transition-all group-hover:right-0 group-hover:shadow-lg dark:group-hover:bg-gray-600' - title='Settings' + className="bg-unherit absolute -right-10 h-full w-8 transition-all group-hover:right-0 group-hover:shadow-lg dark:group-hover:bg-gray-600" + title="Settings" > diff --git a/components/Application/Channels/Channels.tsx b/components/Application/Channels/Channels.tsx index 00968b2..f6a9e22 100644 --- a/components/Application/Channels/Channels.tsx +++ b/components/Application/Channels/Channels.tsx @@ -1,9 +1,9 @@ -import InfiniteScroll from 'react-infinite-scroll-component' +import InfiniteScroll from "react-infinite-scroll-component" -import { useChannels } from '../../../contexts/Channels' -import type { GuildsChannelsPath } from '../Application' -import { Loader } from '../../design/Loader' -import { Channel } from './Channel' +import { useChannels } from "../../../contexts/Channels" +import type { GuildsChannelsPath } from "../Application" +import { Loader } from "../../design/Loader" +import { Channel } from "./Channel" export interface ChannelsProps { path: GuildsChannelsPath @@ -16,12 +16,12 @@ export const Channels: React.FC = (props) => { return (
= ({ ...props }) => {
Illustration -
-

{props.title}

-
+
+

{props.title}

+
diff --git a/components/Application/ConfirmPopup/index.ts b/components/Application/ConfirmPopup/index.ts index 5dcf1f2..37c02a5 100644 --- a/components/Application/ConfirmPopup/index.ts +++ b/components/Application/ConfirmPopup/index.ts @@ -1 +1 @@ -export * from './ConfirmPopup' +export * from "./ConfirmPopup" diff --git a/components/Application/CreateChannel/CreateChannel.tsx b/components/Application/CreateChannel/CreateChannel.tsx index 0f43901..d8dd1b6 100644 --- a/components/Application/CreateChannel/CreateChannel.tsx +++ b/components/Application/CreateChannel/CreateChannel.tsx @@ -1,20 +1,20 @@ -import { useRouter } from 'next/router' -import useTranslation from 'next-translate/useTranslation' -import { Form, useForm } from 'react-component-form' -import type { HandleUseFormCallback } from 'react-component-form' +import { useRouter } from "next/router" +import useTranslation from "next-translate/useTranslation" +import { Form, useForm } from "react-component-form" +import type { HandleUseFormCallback } from "react-component-form" -import { useAuthentication } from '../../../tools/authentication' -import { Input } from '../../design/Input' -import { Main } from '../../design/Main' -import { Button } from '../../design/Button' -import { FormState } from '../../design/FormState' -import type { Channel } from '../../../models/Channel' -import { channelSchema } from '../../../models/Channel' -import { useGuildMember } from '../../../contexts/GuildMember' -import { useFormTranslation } from '../../../hooks/useFormTranslation' +import { useAuthentication } from "../../../tools/authentication" +import { Input } from "../../design/Input" +import { Main } from "../../design/Main" +import { Button } from "../../design/Button" +import { FormState } from "../../design/FormState" +import type { Channel } from "../../../models/Channel" +import { channelSchema } from "../../../models/Channel" +import { useGuildMember } from "../../../contexts/GuildMember" +import { useFormTranslation } from "../../../hooks/useFormTranslation" const schema = { - name: channelSchema.name + name: channelSchema.name, } export const CreateChannel: React.FC = () => { @@ -31,38 +31,38 @@ export const CreateChannel: React.FC = () => { try { const { data: channel } = await authentication.api.post( `/guilds/${guild.id}/channels`, - formData + formData, ) await router.push(`/application/${guild.id}/${channel.id}`) return null } catch (error) { return { - type: 'error', - message: 'errors:server-error' + type: "error", + message: "errors:server-error", } } } return (
-
+
- +
) } diff --git a/components/Application/CreateChannel/index.ts b/components/Application/CreateChannel/index.ts index b4a5a4f..02a8060 100644 --- a/components/Application/CreateChannel/index.ts +++ b/components/Application/CreateChannel/index.ts @@ -1 +1 @@ -export * from './CreateChannel' +export * from "./CreateChannel" diff --git a/components/Application/CreateGuild/CreateGuild.tsx b/components/Application/CreateGuild/CreateGuild.tsx index 84b203c..4459a89 100644 --- a/components/Application/CreateGuild/CreateGuild.tsx +++ b/components/Application/CreateGuild/CreateGuild.tsx @@ -1,22 +1,22 @@ -import { useRouter } from 'next/router' -import useTranslation from 'next-translate/useTranslation' -import { Form, useForm } from 'react-component-form' -import type { AxiosResponse } from 'axios' -import type { HandleUseFormCallback } from 'react-component-form' +import { useRouter } from "next/router" +import useTranslation from "next-translate/useTranslation" +import { Form, useForm } from "react-component-form" +import type { AxiosResponse } from "axios" +import type { HandleUseFormCallback } from "react-component-form" -import { useAuthentication } from '../../../tools/authentication' -import type { GuildComplete } from '../../../models/Guild' -import { guildSchema } from '../../../models/Guild' -import { Input } from '../../design/Input' -import { Main } from '../../design/Main' -import { Button } from '../../design/Button' -import { FormState } from '../../design/FormState' -import { Textarea } from '../../design/Textarea' -import { useFormTranslation } from '../../../hooks/useFormTranslation' +import { useAuthentication } from "../../../tools/authentication" +import type { GuildComplete } from "../../../models/Guild" +import { guildSchema } from "../../../models/Guild" +import { Input } from "../../design/Input" +import { Main } from "../../design/Main" +import { Button } from "../../design/Button" +import { FormState } from "../../design/FormState" +import { Textarea } from "../../design/Textarea" +import { useFormTranslation } from "../../../hooks/useFormTranslation" const schema = { name: guildSchema.name, - description: guildSchema.description + description: guildSchema.description, } export const CreateGuild: React.FC = () => { @@ -33,44 +33,44 @@ export const CreateGuild: React.FC = () => { const { data } = await authentication.api.post< any, AxiosResponse<{ guild: GuildComplete }> - >('/guilds', { name: formData.name, description: formData.description }) + >("/guilds", { name: formData.name, description: formData.description }) const guildId = data.guild.id const channel = data.guild.channels[0] if (channel == null) { - throw new Error('No channel found') + throw new Error("No channel found") } const channelId = channel.id await router.push(`/application/${guildId}/${channelId}`) return null } catch (error) { return { - type: 'error', - message: 'errors:server-error' + type: "error", + message: "errors:server-error", } } } return (
-
+