last changes

This commit is contained in:
Spynder
2025-05-14 14:42:45 +03:00
parent 177653d84a
commit 042b53e6a4
41 changed files with 14316 additions and 900 deletions

View File

@ -11,8 +11,8 @@ import { useEffect } from "react";
import { useShow } from "@refinedev/core";
import { Controller } from "react-hook-form";
import { TOKEN_KEY } from "../../authProvider";
import { MEDIA_TYPES } from "../../lib/constants";
import { TOKEN_KEY } from "@providers";
import { MEDIA_TYPES } from "@lib";
import {
ALLOWED_IMAGE_TYPES,
ALLOWED_VIDEO_TYPES,
@ -22,6 +22,9 @@ import {
ALLOWED_3D_MODEL_TYPES,
useMediaFileUpload,
} from "../../components/media/MediaFormUtils";
import { languageStore, META_LANGUAGE } from "@stores";
import { observer } from "mobx-react-lite";
import { LanguageSelector, MediaData, MediaView } from "@ui";
type MediaFormValues = {
media_name: string;
@ -29,7 +32,8 @@ type MediaFormValues = {
file?: File;
};
export const MediaEdit = () => {
export const MediaEdit = observer(() => {
const { language } = languageStore;
const {
saveButtonProps,
refineCore: { onFinish },
@ -47,6 +51,7 @@ export const MediaEdit = () => {
media_type: "",
file: undefined,
},
refineCoreProps: META_LANGUAGE(language)
});
const { query } = useShow();
@ -100,6 +105,7 @@ export const MediaEdit = () => {
sx={{ display: "flex", flexDirection: "column" }}
autoComplete="off"
>
<LanguageSelector />
<Controller
control={control}
name="media_type"
@ -177,7 +183,7 @@ export const MediaEdit = () => {
hidden
onChange={handleFileChange}
accept={
selectedMediaType === 1
selectedMediaType === 1
? ALLOWED_IMAGE_TYPES.join(",")
: selectedMediaType === 2
? ALLOWED_VIDEO_TYPES.join(",")
@ -207,7 +213,9 @@ export const MediaEdit = () => {
)}
</Box>
{previewUrl && selectedMediaType === 1 && (
<MediaView media={record as MediaData} />
{/* {previewUrl && selectedMediaType === 1 && (
<Box mt={2} display="flex" justifyContent="center">
<img
src={previewUrl}
@ -215,9 +223,9 @@ export const MediaEdit = () => {
style={{ maxWidth: "200px", borderRadius: 8 }}
/>
</Box>
)}
)} */}
</Box>
</Box>
</Edit>
);
};
});