first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import {useForm} from 'react-hook-form';
import React, {ReactNode} from 'react';
import {CrupdateResourceLayout} from '@common/admin/crupdate-resource-layout';
import {Trans} from '@common/i18n/trans';
import {EMPTY_PAGINATION_RESPONSE} from '@common/http/backend-response/pagination-response';
import {UpdateChannelPayload} from '@common/admin/channels/requests/use-update-channel';
import {useCreateChannel} from '@common/admin/channels/requests/use-create-channel';
interface Props {
defaultValues?: Partial<UpdateChannelPayload['config']>;
children: ReactNode;
}
export function CreateChannelPageLayout({defaultValues, children}: Props) {
const form = useForm<UpdateChannelPayload>({
defaultValues: {
content: EMPTY_PAGINATION_RESPONSE.pagination,
config: {
contentType: 'listAll',
contentOrder: 'created_at:desc',
nestedLayout: 'carousel',
...defaultValues,
},
},
});
const createChannel = useCreateChannel(form);
return (
<CrupdateResourceLayout
form={form}
onSubmit={values => {
createChannel.mutate(values);
}}
title={<Trans message="Add new channel" />}
isLoading={createChannel.isPending}
>
{children}
</CrupdateResourceLayout>
);
}