Skip to content

Commit

Permalink
Merge pull request #226 from aXenDeveloper/forum/accordion_category
Browse files Browse the repository at this point in the history
feat(forum): Add accordion for category
  • Loading branch information
aXenDeveloper authored Feb 23, 2024
2 parents 119cbdc + d421597 commit ddbbeb2
Show file tree
Hide file tree
Showing 24 changed files with 371 additions and 176 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useTranslations } from "next-intl";

import { DialogFooter, DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import type { ShowCoreLanguages } from "@/graphql/hooks";
import { Form, FormField } from "@/components/ui/form";
import { useUpdateLangAdmin } from "./hooks/use-update-lang-admin";
Expand All @@ -16,7 +20,9 @@ export const ContentUpdateActionsTableLangsCoreAdmin = ({

return (
<>
<DialogTitle>{t("title", { code })}</DialogTitle>
<DialogHeader>
<DialogTitle>{t("title", { code })}</DialogTitle>
</DialogHeader>

<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
Expand Down
26 changes: 17 additions & 9 deletions frontend/admin/core/views/core/plugins/actions/create/content.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useTranslations } from "next-intl";

import { DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand All @@ -21,7 +25,9 @@ export const ContentCreateActionPluginAdmin = () => {

return (
<>
<DialogTitle>{t("title")}</DialogTitle>
<DialogHeader>
<DialogTitle>{t("title")}</DialogTitle>
</DialogHeader>

<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
Expand Down Expand Up @@ -112,13 +118,15 @@ export const ContentCreateActionPluginAdmin = () => {
)}
/>

<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("create")}
</Button>
<DialogFooter>
<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("create")}
</Button>
</DialogFooter>
</form>
</Form>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import {
useCreateEditNavAdmin,
type CreateEditNavAdminArgs
} from "./hooks/use-create-edit-nav-admin";
import { DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand All @@ -26,7 +30,9 @@ export const ContentCreateEditNavAdmin = ({ data }: CreateEditNavAdminArgs) => {

return (
<>
<DialogTitle>{data ? t("edit.title") : t("create.title")}</DialogTitle>
<DialogHeader>
<DialogTitle>{data ? t("edit.title") : t("create.title")}</DialogTitle>
</DialogHeader>

<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
Expand Down Expand Up @@ -94,13 +100,15 @@ export const ContentCreateEditNavAdmin = ({ data }: CreateEditNavAdminArgs) => {
)}
/>

<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore(data ? "edit" : "create")}
</Button>
<DialogFooter>
<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore(data ? "edit" : "create")}
</Button>
</DialogFooter>
</form>
</Form>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useTranslations } from "next-intl";

import { DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand All @@ -21,7 +25,9 @@ export const ContentCreateActionThemeAdmin = () => {

return (
<>
<DialogTitle>{t("title")}</DialogTitle>
<DialogHeader>
<DialogTitle>{t("title")}</DialogTitle>
</DialogHeader>

<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
Expand Down Expand Up @@ -83,13 +89,15 @@ export const ContentCreateActionThemeAdmin = () => {
)}
/>

<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("create")}
</Button>
<DialogFooter>
<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("create")}
</Button>
</DialogFooter>
</form>
</Form>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { useTranslations } from "next-intl";
import { Form, FormField } from "@/components/ui/form";
import { useThemeUpload } from "./hooks/use-upload-theme";
import { FilesInput } from "@/components/ui/files/files-input";
import { DialogFooter, DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";

export const ContentUploadActionThemeAdmin = () => {
Expand All @@ -12,7 +16,9 @@ export const ContentUploadActionThemeAdmin = () => {

return (
<>
<DialogTitle>{t("title")}</DialogTitle>
<DialogHeader>
<DialogTitle>{t("title")}</DialogTitle>
</DialogHeader>

<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
} from "@/components/ui/form";
import { useDownloadThemeAdmin } from "./hooks/use-download-theme-admin";
import { Input } from "@/components/ui/input";
import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import type { ActionsItemThemesAdminProps } from "../actions";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
Expand Down Expand Up @@ -111,13 +115,15 @@ export const ContentDownloadThemeActionsAdmin = ({
</>
)}

<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{t("submit")}
</Button>
<DialogFooter>
<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{t("submit")}
</Button>
</DialogFooter>
</form>
</Form>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { useTranslations } from "next-intl";

import type { ActionsItemThemesAdminProps } from "../actions";
import { useEditThemeAdmin } from "./hooks/use-edit-theme-admin";
import { DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand All @@ -24,7 +28,9 @@ export const ContentEditThemeActionsAdmin = (

return (
<>
<DialogTitle>{t("edit.title")}</DialogTitle>
<DialogHeader>
<DialogTitle>{t("edit.title")}</DialogTitle>
</DialogHeader>

<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
Expand Down Expand Up @@ -92,13 +98,15 @@ export const ContentEditThemeActionsAdmin = (
</>
)}

<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("edit")}
</Button>
<DialogFooter>
<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("edit")}
</Button>
</DialogFooter>
</form>
</Form>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { Suspense, lazy, useState } from "react";
import { useTranslations } from "next-intl";

import { Tabs } from "@/components/tabs/tabs";
import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import { Form } from "@/components/ui/form";
import { Loader } from "@/components/loader/loader";
import { Button } from "@/components/ui/button";
Expand Down Expand Up @@ -78,13 +82,15 @@ export const CreateEditFormGroupsMembersAdmin = ({
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<Suspense fallback={<Loader />}>{tabsContent[activeTab]}</Suspense>

<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("save")}
</Button>
<DialogFooter>
<Button
disabled={!form.formState.isValid}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("save")}
</Button>
</DialogFooter>
</form>
</Form>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useTranslations } from "next-intl";

import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand Down Expand Up @@ -109,16 +113,18 @@ export const CreateEditFormAdministratorsStaffAdmin = () => {
)}
/>

<Button
disabled={
!form.formState.isValid ||
(!form.watch("user") && !form.watch("group"))
}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("save")}
</Button>
<DialogFooter>
<Button
disabled={
!form.formState.isValid ||
(!form.watch("user") && !form.watch("group"))
}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("save")}
</Button>
</DialogFooter>
</form>
</Form>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useTranslations } from "next-intl";

import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand Down Expand Up @@ -109,16 +113,18 @@ export const CreateEditFormModeratorsStaffAdmin = () => {
)}
/>

<Button
disabled={
!form.formState.isValid ||
(!form.watch("user") && !form.watch("group"))
}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("save")}
</Button>
<DialogFooter>
<Button
disabled={
!form.formState.isValid ||
(!form.watch("user") && !form.watch("group"))
}
loading={form.formState.isSubmitting}
type="submit"
>
{tCore("save")}
</Button>
</DialogFooter>
</form>
</Form>
);
Expand Down
Loading

0 comments on commit ddbbeb2

Please sign in to comment.