fix: 🚧 fix eslint part.457
This commit is contained in:
parent
5734750649
commit
5142580aff
44 changed files with 426 additions and 373 deletions
|
|
@ -10,6 +10,7 @@
|
|||
"eslint-fix": "node ./node_modules/.bin/eslint --config './.eslintrc.cjs' --max-warnings 0 resources/ts --ext .ts,.tsx --fix",
|
||||
"eslint-ci": "node ./node_modules/.bin/eslint --config './.eslintrc.cjs' --max-warnings 0 resources/ts --ext .ts,.tsx -f junit",
|
||||
"stylelint": "node ./node_modules/.bin/stylelint --config './.stylelintrc.json' --max-warnings 0 '**/resources/**/*.scss'",
|
||||
"stylelint-fix": "node ./node_modules/.bin/stylelint --config './.stylelintrc.json' --max-warnings 0 '**/resources/**/*.scss' --fix",
|
||||
"stylelint-ci": "node ./node_modules/.bin/stylelint --config './.stylelintrc.json' --max-warnings 0 '**/resources/**/*.scss' -f json"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
101
resources/sass/back/inputs/_color.scss
Normal file
101
resources/sass/back/inputs/_color.scss
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
.sketch-picker {
|
||||
display: flex;
|
||||
width: 100% !important;
|
||||
flex-direction: column;
|
||||
padding: 0 !important;
|
||||
border: 0 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.sketch-picker,
|
||||
.sketch-picker .flexbox-fix {
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.sketch-picker > div,
|
||||
.sketch-picker .flexbox-fix > div {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.sketch-picker > div:first-child {
|
||||
border-radius: calc(var(--radius) - 2px);
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
.sketch-picker > div:last-child {
|
||||
justify-content: space-between;
|
||||
padding-top: 0.375rem !important;
|
||||
}
|
||||
|
||||
.sketch-picker > div:nth-child(3) > div {
|
||||
flex: auto !important;
|
||||
}
|
||||
|
||||
.sketch-picker > div:last-child > div {
|
||||
width: 20px !important;
|
||||
height: 20px !important;
|
||||
}
|
||||
|
||||
.sketch-picker > div:last-child > div > span > div {
|
||||
border-radius: calc(var(--radius) - 2px) !important;
|
||||
box-shadow: none !important;
|
||||
outline: 1px solid hsl(var(--input)) !important;
|
||||
}
|
||||
|
||||
.sketch-picker > div:nth-child(2) > div:first-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.sketch-picker > div:nth-child(2) > div:last-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sketch-picker > div:nth-child(3) > div:first-child {
|
||||
width: 16rem;
|
||||
}
|
||||
|
||||
.sketch-picker > div:nth-child(2) > div:first-child > div {
|
||||
height: 20px !important;
|
||||
border-radius: calc(var(--radius) - 2px);
|
||||
margin: 0 !important;
|
||||
cursor: pointer;
|
||||
outline: 1px solid hsl(var(--input));
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line selector-max-compound-selectors */
|
||||
.sketch-picker > div:first-child > div > div > div:last-child > div {
|
||||
width: 10px !important;
|
||||
height: 10px !important;
|
||||
border-radius: 50% !important;
|
||||
background-color: #fff;
|
||||
box-shadow: none !important;
|
||||
transform: translate(-5px, -5px) !important;
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line selector-max-compound-selectors */
|
||||
.sketch-picker > div:nth-child(2) > div:first-child > div > div > div > div > div {
|
||||
width: 0.5rem !important;
|
||||
height: 20px !important;
|
||||
border: 1px hsl(var(--input)) solid;
|
||||
border-radius: 0 !important;
|
||||
margin-top: 0 !important;
|
||||
background: #fff !important;
|
||||
box-shadow: none !important;
|
||||
transform: translateX(-4px) !important;
|
||||
}
|
||||
|
||||
.sketch-picker input {
|
||||
width: 100% !important;
|
||||
height: 2.5rem;
|
||||
padding: 0.5rem 0.75rem !important;
|
||||
border: 1px hsl(var(--input)) solid !important;
|
||||
border-radius: calc(var(--radius) - 2px) !important;
|
||||
background-color: hsl(var(--background));
|
||||
box-shadow: none !important;
|
||||
color: var(--foreground);
|
||||
outline: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
@ -49,6 +49,27 @@ export default function BtnOptionnalLinkWithTooltip({
|
|||
onClick,
|
||||
...props
|
||||
}: BtnOptionnalLinkWithTooltipProps) {
|
||||
let innerContent: ReactNode = content;
|
||||
|
||||
if (link !== null) {
|
||||
if (externalLink) {
|
||||
innerContent = (
|
||||
<a
|
||||
href={disabled ? undefined : link}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className={cn({
|
||||
"pointer-events-none opacity-50": disabled,
|
||||
})}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
} else {
|
||||
innerContent = <Link href={link}>{content}</Link>;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
|
|
@ -63,24 +84,7 @@ export default function BtnOptionnalLinkWithTooltip({
|
|||
style={style}
|
||||
{...props}
|
||||
>
|
||||
{link !== null ? (
|
||||
externalLink ? (
|
||||
<a
|
||||
href={!disabled ? link : undefined}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className={cn({
|
||||
"pointer-events-none opacity-50": disabled,
|
||||
})}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
) : (
|
||||
<Link href={link}>{content}</Link>
|
||||
)
|
||||
) : (
|
||||
content
|
||||
)}
|
||||
{innerContent}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{tooltipContent}</TooltipContent>
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import str from "@/hooks/use-string";
|
|||
import DataTable from "@/back/Components/Table/DataTable";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { AppEnv, Resource } from "@/back/types/global";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import { DocumentModel } from "@/back/types/others";
|
||||
import { Views } from "@/lib/utils";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
interface Props {
|
||||
documents: Resource;
|
||||
|
|
@ -32,9 +32,9 @@ function AssociatedDocumentList(props: Props) {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<DocumentModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<DocumentModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "path",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// * Packages
|
||||
import { usePage } from "@inertiajs/react";
|
||||
import { useEffect, useRef } from "react";
|
||||
// * Other
|
||||
import SimpleString from "@/back/Components/Inputs/SimpleString";
|
||||
import SimpleNumber from "@/back/Components/Inputs/SimpleNumber";
|
||||
|
|
@ -14,8 +13,8 @@ import SimpleColorPicker from "@/back/Components/Inputs/SimpleColorPicker";
|
|||
import SimpleYoutubeId from "@/back/Components/Inputs/SimpleYoutubeId";
|
||||
import SimpleVimeoId from "@/back/Components/Inputs/SimpleVimeoId";
|
||||
import EnumSelect from "@/back/Components/Inputs/EnumSelect";
|
||||
import { ModelSelect } from "@/back/Components/Inputs/ModelSelect";
|
||||
import StaticRouteSelect from "@/back/Components/Inputs/StaticRouteSelect";
|
||||
import DynamicWrapperModelSelect from "@/back/Components/DynamicPages/DynamicWrapperModelSelect";
|
||||
import { LaravelEnum } from "@/back/types/global";
|
||||
import {
|
||||
ConfigField,
|
||||
|
|
@ -25,13 +24,12 @@ import {
|
|||
import str from "@/hooks/use-string";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import {
|
||||
extractExcludedIdFromExists,
|
||||
extractLaravelValidationValue,
|
||||
extractMinMaxFromValidation,
|
||||
extractRequiredValidation,
|
||||
extractTableFromExists,
|
||||
} from "@/hooks/use-laravel-validation";
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
type DynamicInputsProps = {
|
||||
name: string;
|
||||
config: ConfigField[];
|
||||
|
|
@ -44,6 +42,7 @@ type DynamicInputsProps = {
|
|||
reset: (name?: string) => void;
|
||||
parentErrors?: Record<string, string> | null;
|
||||
};
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
// Allows to get specific input from enum value.
|
||||
export default function DynamicInputs({
|
||||
|
|
@ -332,55 +331,14 @@ export default function DynamicInputs({
|
|||
);
|
||||
// Model select.
|
||||
case enumDynamicFieldTypes.model.value:
|
||||
// Extract only the model name from the validation.
|
||||
const targetModel =
|
||||
extractTableFromExists(field.validation) ||
|
||||
"dynamic_pages";
|
||||
|
||||
// Add a custom prefix in the last part of the name.
|
||||
const newName = fieldName.replace(
|
||||
/([^.\s]+)$/,
|
||||
"reserved_$1",
|
||||
);
|
||||
|
||||
// Set a state at false.
|
||||
const initializedRef = useRef(false);
|
||||
|
||||
// Set the model name in the custom key only once.
|
||||
useEffect(() => {
|
||||
if (initializedRef.current) return;
|
||||
initializedRef.current = true;
|
||||
|
||||
// If the value isn't already present in content.
|
||||
if (
|
||||
content &&
|
||||
!content[
|
||||
`reserved_${field.key}` as keyof typeof content
|
||||
]
|
||||
) {
|
||||
setData(newName, targetModel);
|
||||
}
|
||||
}, [newName, targetModel]);
|
||||
|
||||
return (
|
||||
<ModelSelect
|
||||
name={fieldName}
|
||||
multiple={false}
|
||||
closeOnSelect
|
||||
responsive
|
||||
targetModel={targetModel}
|
||||
label={getTrans(field.label)}
|
||||
exclude={extractExcludedIdFromExists(
|
||||
field.validation,
|
||||
)}
|
||||
placeholder="ex: John Doe"
|
||||
defaultValues={
|
||||
fieldValue ? [Number(fieldValue)] : []
|
||||
}
|
||||
required={extractRequiredValidation(
|
||||
field.validation,
|
||||
)}
|
||||
<DynamicWrapperModelSelect
|
||||
field={field}
|
||||
fieldName={fieldName}
|
||||
fieldValue={fieldValue}
|
||||
content={content}
|
||||
setData={setData}
|
||||
getTrans={getTrans}
|
||||
/>
|
||||
);
|
||||
// Static route select.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import {
|
|||
import { ConfigField, DynamicInternalField } from "@/back/types/dynamic-pages";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
type DynamicListProps = {
|
||||
name: string;
|
||||
parentName: string;
|
||||
|
|
@ -52,6 +53,7 @@ type DynamicListProps = {
|
|||
) => void;
|
||||
reset: (name?: string) => void;
|
||||
};
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
// Allows to get recursive list inputs.
|
||||
export default function DynamicList({
|
||||
|
|
@ -140,8 +142,8 @@ export default function DynamicList({
|
|||
) => {
|
||||
// Get the current list of elements.
|
||||
const list = Array.isArray(content?.[fieldKey as keyof typeof content])
|
||||
// @ts-expect-error
|
||||
? [...content[fieldKey as keyof typeof content]]
|
||||
? // @ts-expect-error Weird error type.
|
||||
[...content[fieldKey as keyof typeof content]]
|
||||
: [];
|
||||
// Remove the targeted element.
|
||||
list.splice(index, 1);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
// * Packages
|
||||
import { useEffect, useRef } from "react";
|
||||
// * Other
|
||||
import { ModelSelect } from "@/back/Components/Inputs/ModelSelect";
|
||||
import {
|
||||
extractExcludedIdFromExists,
|
||||
extractRequiredValidation,
|
||||
extractTableFromExists,
|
||||
} from "@/hooks/use-laravel-validation";
|
||||
import { ConfigField, DynamicInternalField } from "@/back/types/dynamic-pages";
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
type DynamicWrapperModelSelectProps = {
|
||||
field: ConfigField;
|
||||
fieldName: string;
|
||||
fieldValue: string | number | boolean | File | Date;
|
||||
content: DynamicInternalField | null;
|
||||
setData: (
|
||||
name: string,
|
||||
value: string | number | boolean | File | object | null,
|
||||
) => void;
|
||||
getTrans: (fieldLabel: string) => string;
|
||||
};
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
export default function DynamicWrapperModelSelect({
|
||||
field,
|
||||
fieldName,
|
||||
fieldValue,
|
||||
content,
|
||||
setData,
|
||||
getTrans,
|
||||
}: DynamicWrapperModelSelectProps) {
|
||||
// Extract only the model name from the validation.
|
||||
const targetModel =
|
||||
extractTableFromExists(field.validation) || "dynamic_pages";
|
||||
|
||||
// Add a custom prefix in the last part of the name.
|
||||
const newName = fieldName.replace(/([^.\s]+)$/, "reserved_$1");
|
||||
|
||||
// Set a state at false.
|
||||
const initializedRef = useRef(false);
|
||||
|
||||
// Set the model name in the custom key only once.
|
||||
useEffect(() => {
|
||||
if (initializedRef.current) return;
|
||||
initializedRef.current = true;
|
||||
|
||||
// If the value isn't already present in content.
|
||||
if (
|
||||
content &&
|
||||
!content[`reserved_${field.key}` as keyof typeof content]
|
||||
) {
|
||||
setData(newName, targetModel);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [newName, targetModel]);
|
||||
|
||||
return (
|
||||
<ModelSelect
|
||||
name={fieldName}
|
||||
multiple={false}
|
||||
closeOnSelect
|
||||
responsive
|
||||
targetModel={targetModel}
|
||||
label={getTrans(field.label)}
|
||||
exclude={extractExcludedIdFromExists(field.validation)}
|
||||
placeholder="ex: John Doe"
|
||||
defaultValues={fieldValue ? [Number(fieldValue)] : []}
|
||||
required={extractRequiredValidation(field.validation)}
|
||||
setData={setData}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -29,7 +29,9 @@ type EnumSelectProps = {
|
|||
required?: boolean;
|
||||
disabled?: boolean;
|
||||
parentErrors?: Record<string, string> | null;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setData: (name: string, value: number | null) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
onSelectValue?: (value: number | null) => void;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ type SimpleColorPickerProps = {
|
|||
required?: boolean;
|
||||
disabled?: boolean;
|
||||
parentErrors?: Record<string, string> | null;
|
||||
/* eslint-disable no-unused-vars */
|
||||
setData: (name: string, value: string | null) => void;
|
||||
};
|
||||
|
||||
|
|
@ -87,15 +88,15 @@ export default function SimpleColorPicker({
|
|||
/**
|
||||
* Convert ColorResult → HEXA.
|
||||
*
|
||||
* @param color ColorResult
|
||||
* @param targetColor ColorResult
|
||||
* @return string
|
||||
*/
|
||||
function toHEXA(color: ColorResult): string {
|
||||
const r = color.rgb.r.toString(16).padStart(2, "0");
|
||||
const g = color.rgb.g.toString(16).padStart(2, "0");
|
||||
const b = color.rgb.b.toString(16).padStart(2, "0");
|
||||
function toHEXA(targetColor: ColorResult): string {
|
||||
const r = targetColor.rgb.r.toString(16).padStart(2, "0");
|
||||
const g = targetColor.rgb.g.toString(16).padStart(2, "0");
|
||||
const b = targetColor.rgb.b.toString(16).padStart(2, "0");
|
||||
const a =
|
||||
Math.round((color.rgb.a ?? 1) * 255)
|
||||
Math.round((targetColor.rgb.a ?? 1) * 255)
|
||||
.toString(16)
|
||||
.padStart(2, "0") ?? "ff";
|
||||
return `#${r}${g}${b}${a}`;
|
||||
|
|
@ -143,11 +144,11 @@ export default function SimpleColorPicker({
|
|||
/**
|
||||
* Update color via picker.
|
||||
*
|
||||
* @param color ColorResult
|
||||
* @param targetColor ColorResult
|
||||
* @return void
|
||||
*/
|
||||
function handleChangeComplete(color: ColorResult): void {
|
||||
const hex = toHEXA(color);
|
||||
function handleChangeComplete(targetColor: ColorResult): void {
|
||||
const hex = toHEXA(targetColor);
|
||||
setColor(hex);
|
||||
setData(name, hex);
|
||||
}
|
||||
|
|
@ -195,6 +196,7 @@ export default function SimpleColorPicker({
|
|||
|
||||
useEffect(() => {
|
||||
if (value !== color) setColor(value);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
|
|
@ -239,94 +241,6 @@ export default function SimpleColorPicker({
|
|||
disableAlpha={false}
|
||||
presetColors={presetColors}
|
||||
/>
|
||||
{/* Force custom style */}
|
||||
<style>
|
||||
{`
|
||||
.sketch-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 !important;
|
||||
border: 0 !important;
|
||||
box-shadow: none !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
.sketch-picker, .sketch-picker .flexbox-fix {
|
||||
gap: 0.375rem;
|
||||
}
|
||||
.sketch-picker > div, .sketch-picker .flexbox-fix > div {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.sketch-picker > div:first-child {
|
||||
aspect-ratio: 1 / 1;
|
||||
border-radius: calc(var(--radius) - 2px);
|
||||
}
|
||||
.sketch-picker > div:first-child > div > div > div:last-child > div {
|
||||
width: 10px !important;
|
||||
height: 10px !important;
|
||||
box-shadow: none !important;
|
||||
border-radius: 50% !important;
|
||||
transform: translate(-5px, -5px) !important;
|
||||
background-color: white;
|
||||
}
|
||||
.sketch-picker > div:nth-child(2) > div:first-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
.sketch-picker > div:nth-child(2) > div:first-child > div {
|
||||
height: 20px !important;
|
||||
outline: 1px solid hsl(var(--input));
|
||||
border-radius: calc(var(--radius) - 2px);
|
||||
margin: 0rem !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sketch-picker > div:nth-child(2) > div:first-child > div > div > div > div > div {
|
||||
width: 0.5rem !important;
|
||||
height: 20px !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none !important;
|
||||
background: rgb(255, 255, 255) !important;
|
||||
transform: translateX(-4px) !important;
|
||||
margin-top: 0 !important;
|
||||
border: 1px hsl(var(--input)) solid;
|
||||
}
|
||||
.sketch-picker > div:nth-child(2) > div:last-child {
|
||||
display: none;
|
||||
}
|
||||
.sketch-picker > div:nth-child(3) > div:first-child {
|
||||
width: 16rem;
|
||||
}
|
||||
.sketch-picker > div:nth-child(3) > div {
|
||||
flex: auto !important;
|
||||
}
|
||||
.sketch-picker > div:last-child {
|
||||
justify-content: space-between;
|
||||
padding-top: 0.375rem !important;
|
||||
}
|
||||
.sketch-picker > div:last-child > div {
|
||||
width: 20px !important;
|
||||
height: 20px !important;
|
||||
}
|
||||
.sketch-picker > div:last-child > div > span > div {
|
||||
box-shadow: none !important;
|
||||
outline: 1px solid hsl(var(--input)) !important;
|
||||
border-radius: calc(var(--radius) - 2px) !important;
|
||||
}
|
||||
.sketch-picker input {
|
||||
width: 100% !important;
|
||||
height: 2.5rem;
|
||||
border-radius: calc(var(--radius) - 2px) !important;
|
||||
border: 1px hsl(var(--input)) solid !important;
|
||||
background-color: hsl(var(--background));
|
||||
padding: 0.5rem 0.75rem !important;
|
||||
color: var(--foreground);
|
||||
box-shadow: none !important;
|
||||
outline: none;
|
||||
text-align: center;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
{/* Random Color */}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,16 @@ import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithT
|
|||
import str from "@/hooks/use-string";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
|
||||
interface Props {
|
||||
setData: (name: string, value: string) => void;
|
||||
interface SlugifycatorProps {
|
||||
value: string;
|
||||
targetValue: string;
|
||||
wordCounter?: boolean;
|
||||
disabled?: boolean;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setData: (name: string, value: string) => void;
|
||||
}
|
||||
function Slugifycator(props: Props) {
|
||||
|
||||
export default function Slugifycator(props: SlugifycatorProps) {
|
||||
const {
|
||||
value,
|
||||
targetValue,
|
||||
|
|
@ -52,5 +54,3 @@ function Slugifycator(props: Props) {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Slugifycator;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ interface Props {
|
|||
setData: (name: string, value: number | null) => void;
|
||||
}
|
||||
|
||||
function StaticRouteSelect(props: Props) {
|
||||
export default function StaticRouteSelect(props: Props) {
|
||||
const { name, selected, required, label, setData } = props;
|
||||
|
||||
const enumStaticRoutes = usePage().props
|
||||
|
|
@ -41,5 +41,3 @@ function StaticRouteSelect(props: Props) {
|
|||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default StaticRouteSelect;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ type ImageInputsProps = {
|
|||
caption: string | null;
|
||||
hasCaption: boolean;
|
||||
};
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
onChange: (value: ImageInputsProps["value"]) => void;
|
||||
errors?: Record<string, string>;
|
||||
loading?: boolean;
|
||||
|
|
|
|||
|
|
@ -40,16 +40,6 @@ import str from "@/hooks/use-string";
|
|||
import { cn } from "@/lib/utils";
|
||||
import { parseStyleString } from "@/hooks/use-inline-style";
|
||||
|
||||
type ImageAttrs = {
|
||||
src: string;
|
||||
alt: string;
|
||||
width: number;
|
||||
height: number;
|
||||
caption: string | null;
|
||||
style: string;
|
||||
float: FloatOption;
|
||||
};
|
||||
|
||||
export type AllowedAligns = "left" | "center" | "right";
|
||||
|
||||
export type FloatOption = "left" | "right";
|
||||
|
|
@ -88,6 +78,16 @@ const PLACEMENT_STYLES: Record<PlacementValue, string> = {
|
|||
"float-right": FLOAT_STYLES.right,
|
||||
};
|
||||
|
||||
type ImageAttrs = {
|
||||
src: string;
|
||||
alt: string;
|
||||
width: number;
|
||||
height: number;
|
||||
caption: string | null;
|
||||
style: string;
|
||||
float: FloatOption;
|
||||
};
|
||||
|
||||
export default function ImageNodeView(props: NodeViewProps) {
|
||||
const { node, updateAttributes, editor, selected } = props;
|
||||
const attrs = node.attrs as ImageAttrs;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,28 @@ export default function FindReplaceButton({ editor }: { editor: Editor }) {
|
|||
// Duration of modal closing animation.
|
||||
const animationTime = 200;
|
||||
|
||||
/**
|
||||
* Reset the component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
const resetComponent = (): void => {
|
||||
setSearchText("");
|
||||
setReplaceText("");
|
||||
setMatchCase(false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Close modal and reset component.
|
||||
*
|
||||
* @param status boolean
|
||||
* @return void
|
||||
*/
|
||||
const closeModal = (status: boolean = false): void => {
|
||||
setOpen(status);
|
||||
setTimeout(() => resetComponent(), animationTime);
|
||||
};
|
||||
|
||||
/**
|
||||
* Search and replace specific text.
|
||||
*
|
||||
|
|
@ -53,28 +75,6 @@ export default function FindReplaceButton({ editor }: { editor: Editor }) {
|
|||
closeModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset the component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
const resetComponent = (): void => {
|
||||
setSearchText("");
|
||||
setReplaceText("");
|
||||
setMatchCase(false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Close modal and reset component.
|
||||
*
|
||||
* @param status boolean
|
||||
* @return void
|
||||
*/
|
||||
const closeModal = (status: boolean = false): void => {
|
||||
setOpen(status);
|
||||
setTimeout(() => resetComponent(), animationTime);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(status) => closeModal(status)}>
|
||||
<DialogTrigger asChild>
|
||||
|
|
|
|||
|
|
@ -86,16 +86,6 @@ export default function TableButton({ editor, disabled }: TableProps) {
|
|||
setHeader(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Insert tableClose modal and reset component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
const handleInsertTable = (): void => {
|
||||
insert();
|
||||
closeModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* Close modal and reset component.
|
||||
*
|
||||
|
|
@ -106,6 +96,16 @@ export default function TableButton({ editor, disabled }: TableProps) {
|
|||
setTimeout(() => resetComponent(), animationTime);
|
||||
};
|
||||
|
||||
/**
|
||||
* Insert tableClose modal and reset component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
const handleInsertTable = (): void => {
|
||||
insert();
|
||||
closeModal();
|
||||
};
|
||||
|
||||
// Set size of the current table on hover.
|
||||
useEffect(() => {
|
||||
setHover({ row: rows, column: cols });
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ type SimpleWysiwygProps = {
|
|||
required?: boolean;
|
||||
disabled?: boolean;
|
||||
parentErrors?: Record<string, string> | null;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setData: (name: string, value: string) => void;
|
||||
};
|
||||
|
||||
|
|
@ -136,6 +137,7 @@ export default function SimpleWysiwyg({
|
|||
setEditor(e);
|
||||
|
||||
return () => e.destroy();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// Sync content if parent change.
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
// * Packages
|
||||
import { Row } from "@tanstack/react-table";
|
||||
import { usePage } from "@inertiajs/react";
|
||||
import { NewspaperIcon } from "lucide-react";
|
||||
// * Components shadcn
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
// * Other
|
||||
import DataTable from "@/back/Components/Table/DataTable";
|
||||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import { AppEnv, Resource } from "@/back/types/global";
|
||||
import { Resource } from "@/back/types/global";
|
||||
import { NewsModel } from "@/back/types/others";
|
||||
import NewsStatusBadge from "@/back/Components/News/NewsStatusBadge";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
|
|
@ -21,9 +20,6 @@ interface Props {
|
|||
}
|
||||
function AssociatedNewsList(props: Props) {
|
||||
const { news } = props;
|
||||
const { appEnv } = usePage().props as unknown as {
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
|
@ -36,9 +32,9 @@ function AssociatedNewsList(props: Props) {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<NewsModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("title"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<NewsModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("title")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "status",
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default function ConfigDetails({ config }: ConfigDetailsProps) {
|
|||
const hasChildren = !!field.children?.length;
|
||||
const accordionKey = `${field.key}-${index}`;
|
||||
|
||||
const rowContent = (hasChildren: boolean = false) => (
|
||||
const rowContent = (targetHasChildren: boolean = false) => (
|
||||
<div className="grid grid-cols-[1fr_1fr_1fr_auto] items-center w-full gap-4">
|
||||
<p className="break-words">
|
||||
{getEnumDynamicFieldType(field.type)?.label}
|
||||
|
|
@ -55,7 +55,7 @@ export default function ConfigDetails({ config }: ConfigDetailsProps) {
|
|||
<div className="text-sm text-muted-foreground break-words">
|
||||
{field.validation || "—"}
|
||||
</div>
|
||||
{!hasChildren && <div className="w-[16px]" />}
|
||||
{!targetHasChildren && <div className="w-[16px]" />}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ export default function DynamicFields({
|
|||
let currentId = startId;
|
||||
|
||||
const withIds = fields.map((field) => {
|
||||
const id = currentId++;
|
||||
currentId += 1;
|
||||
const id = currentId;
|
||||
|
||||
// Add the key in sensitive array.
|
||||
const currentParentKey = `${parentKey}.${field.key}`;
|
||||
|
|
@ -197,18 +198,6 @@ export default function DynamicFields({
|
|||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a specific field.
|
||||
* @param fieldId string
|
||||
* @returns void
|
||||
*/
|
||||
const removeField = (fieldId: number): void => {
|
||||
const targetField = fields.filter((field) => field.id === fieldId)[0];
|
||||
|
||||
removeSensitiveField(targetField.key);
|
||||
setFields((prev) => prev.filter((field) => field.id !== fieldId));
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove sensitive field list.
|
||||
* @param keyToRemove string
|
||||
|
|
@ -221,6 +210,18 @@ export default function DynamicFields({
|
|||
setLocalErrors({});
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a specific field.
|
||||
* @param fieldId string
|
||||
* @returns void
|
||||
*/
|
||||
const removeField = (fieldId: number): void => {
|
||||
const targetField = fields.filter((field) => field.id === fieldId)[0];
|
||||
|
||||
removeSensitiveField(targetField.key);
|
||||
setFields((prev) => prev.filter((field) => field.id !== fieldId));
|
||||
};
|
||||
|
||||
/**
|
||||
* Save the new order.
|
||||
* @param event DragEndEvent
|
||||
|
|
@ -249,11 +250,11 @@ export default function DynamicFields({
|
|||
|
||||
/**
|
||||
* Remove all local ids.
|
||||
* @param fields ConfigInternalField[]
|
||||
* @param currentFields ConfigInternalField[]
|
||||
* @returns
|
||||
*/
|
||||
const removeIds = (fields: ConfigInternalField[]): ConfigField[] => {
|
||||
return fields.map(({ id, children, ...rest }) => ({
|
||||
const removeIds = (currentFields: ConfigInternalField[]): ConfigField[] => {
|
||||
return currentFields.map(({ children, ...rest }) => ({
|
||||
...rest,
|
||||
...(children ? { children: removeIds(children) } : {}),
|
||||
})) as ConfigField[];
|
||||
|
|
@ -267,11 +268,13 @@ export default function DynamicFields({
|
|||
setData(name, payload);
|
||||
prevValueRef.current = payloadStr;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [fields]);
|
||||
|
||||
// Update fields when copying config from another locale.
|
||||
useEffect(() => {
|
||||
setFields(() => addIdsRecursively(value ?? []));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedConfig]);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import str from "@/hooks/use-string";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
type FieldGroupProps = {
|
||||
currentId: number;
|
||||
currentIndex: number;
|
||||
|
|
@ -63,6 +64,7 @@ type FieldGroupProps = {
|
|||
setParentAccordionState: (key: string) => void;
|
||||
limitMaxChildren: number;
|
||||
};
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
export default function FieldGroup({
|
||||
currentId,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// * Packages
|
||||
import { useRef, useState } from "react";
|
||||
import { ChangeEvent, DragEvent, useRef, useState } from "react";
|
||||
import {
|
||||
JsonEditor,
|
||||
IconReplacements,
|
||||
|
|
@ -41,6 +41,7 @@ type JsonObject = {
|
|||
};
|
||||
|
||||
type ImportConfigJsonProps = {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
onConfirm: (data: JsonObject[], overwrite: boolean) => void;
|
||||
};
|
||||
|
||||
|
|
@ -188,13 +189,28 @@ export default function ImportConfigJson({ onConfirm }: ImportConfigJsonProps) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
const resetComponent = (): void => {
|
||||
setIsOpen(false);
|
||||
setTimeout(() => {
|
||||
setJsonText([]);
|
||||
setGlobalErrors({});
|
||||
setEditorErrors({});
|
||||
setOverwrite(false);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
/**
|
||||
* Action when changing file.
|
||||
*
|
||||
* @param event
|
||||
* @return void
|
||||
*/
|
||||
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
||||
const handleFileChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
||||
const file = e.target.files?.[0];
|
||||
if (file) processFile(file);
|
||||
};
|
||||
|
|
@ -205,7 +221,7 @@ export default function ImportConfigJson({ onConfirm }: ImportConfigJsonProps) {
|
|||
* @param event
|
||||
* @return void
|
||||
*/
|
||||
const handleDrop = (event: React.DragEvent<HTMLDivElement>): void => {
|
||||
const handleDrop = (event: DragEvent<HTMLDivElement>): void => {
|
||||
event.preventDefault();
|
||||
setIsDragging(false);
|
||||
|
||||
|
|
@ -234,21 +250,6 @@ export default function ImportConfigJson({ onConfirm }: ImportConfigJsonProps) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
const resetComponent = (): void => {
|
||||
setIsOpen(false);
|
||||
setTimeout(() => {
|
||||
setJsonText([]);
|
||||
setGlobalErrors({});
|
||||
setEditorErrors({});
|
||||
setOverwrite(false);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Dropzone */}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function useGetTranslationValue(
|
|||
* @param value - Translation field containing localized values
|
||||
* @return A ReactNode ready to be rendered inside a table cell
|
||||
*/
|
||||
function RenderTranslationCell({
|
||||
export default function RenderTranslationCell({
|
||||
value,
|
||||
}: {
|
||||
value?: TranslationField;
|
||||
|
|
@ -67,5 +67,3 @@ function RenderTranslationCell({
|
|||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export default RenderTranslationCell;
|
||||
|
|
@ -27,11 +27,13 @@ function LayoutContent({
|
|||
}: Omit<AuthenticatedLayoutProps, "children"> & { children: ReactNode }) {
|
||||
const { open } = useSidebar();
|
||||
const [isSm, setIsSm] = useState(false);
|
||||
const sidebarVar = !isSm
|
||||
? open
|
||||
|
||||
let sidebarVar = "0px";
|
||||
if (!isSm) {
|
||||
sidebarVar = open
|
||||
? "var(--sidebar-width)"
|
||||
: "var(--sidebar-width-icon)"
|
||||
: "0px";
|
||||
: "var(--sidebar-width-icon)";
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const mediaQuery = window.matchMedia("(max-width: 767px)");
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ const getColumns = (activityLogsEventEnum: ActivityLogsEventEnumProps) => {
|
|||
),
|
||||
cell: ({ row }: { row: Row<ActivityLogModel> }) => {
|
||||
const modelClass = row.getValue<string>("model_class");
|
||||
const { event, model_id } = row.original;
|
||||
const { event, model_id: modelId } = row.original;
|
||||
|
||||
const modelSplit = modelClass.split("\\");
|
||||
const modelName = modelSplit[modelSplit.length - 1];
|
||||
|
|
@ -164,7 +164,7 @@ const getColumns = (activityLogsEventEnum: ActivityLogsEventEnumProps) => {
|
|||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(
|
||||
`back.${str(model).plural().value()}.show`,
|
||||
model_id,
|
||||
modelId,
|
||||
)}
|
||||
content={
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import { AuthProp, Resource } from "@/back/types/global";
|
|||
import { CompanyActivityModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
|
||||
const getColumns = () => {
|
||||
|
|
@ -55,9 +55,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<CompanyActivityModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<CompanyActivityModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "color",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import DetailsTable from "@/back/Components/Table/DetailsTable";
|
|||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedCompaniesList from "@/back/Components/AssociatedCompaniesList";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AuthProp, Resource, SingleResource } from "@/back/types/global";
|
||||
|
|
@ -17,7 +18,6 @@ import { TranslationField } from "@/back/types/i18n";
|
|||
import { CompanyActivityModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -36,9 +36,9 @@ const getColumns = () => {
|
|||
header: str(GetTranslation("validation.attributes.name"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "color",
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ import DataTableSearch from "@/back/Components/Table/DataTableSearch";
|
|||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { AppEnv, AuthProp, Resource } from "@/back/types/global";
|
||||
import { CompanySectorModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
|
||||
const getColumns = () => {
|
||||
|
|
@ -50,9 +50,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<CompanySectorModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<CompanySectorModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "companies",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import DetailsTable from "@/back/Components/Table/DetailsTable";
|
|||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedCompaniesList from "@/back/Components/AssociatedCompaniesList";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AuthProp, Resource, SingleResource } from "@/back/types/global";
|
||||
|
|
@ -17,7 +18,6 @@ import { CompanySectorModel } from "@/back/types/others";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -36,9 +36,9 @@ const getColumns = () => {
|
|||
header: str(GetTranslation("validation.attributes.name"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "published",
|
||||
|
|
|
|||
|
|
@ -19,11 +19,10 @@ import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithT
|
|||
import DocumentStatusBadge from "@/back/Components/Documents/DocumentStatusBadge";
|
||||
import Filters from "@/back/Components/Documents/Filters";
|
||||
import { cn, Views } from "@/lib/utils";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AppEnv, AuthProp, Resource } from "@/back/types/global";
|
||||
import { DocumentModel, DocumentCategoryModel } from "@/back/types/others";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
|
||||
|
|
@ -86,9 +85,7 @@ const getColumns = (appEnv: AppEnv, viewAnyDocumentCategories: boolean) => {
|
|||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{RenderTranslationCell(
|
||||
row.getValue("name") as TranslationField,
|
||||
)}
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import DataTable from "@/back/Components/Table/DataTable";
|
|||
import DataTableSearch from "@/back/Components/Table/DataTableSearch";
|
||||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
|
|
@ -18,7 +19,6 @@ import { AppEnv, AuthProp, Resource } from "@/back/types/global";
|
|||
import { DocumentCategoryModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -44,9 +44,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<DocumentCategoryModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<DocumentCategoryModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "documents",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import { Badge } from "@/components/ui/badge";
|
|||
import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
||||
import DetailsTable from "@/back/Components/Table/DetailsTable";
|
||||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedDocumentList from "@/back/Components/Documents/AssociatedDocumentList";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import {
|
||||
|
|
@ -20,9 +23,6 @@ import { DocumentTagModel } from "@/back/types/others";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedDocumentList from "@/back/Components/Documents/AssociatedDocumentList";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (appEnv: AppEnv) => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -41,9 +41,9 @@ const getColumns = (appEnv: AppEnv) => {
|
|||
header: str(GetTranslation("validation.attributes.name"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "slug",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import DataTable from "@/back/Components/Table/DataTable";
|
|||
import DataTableSearch from "@/back/Components/Table/DataTableSearch";
|
||||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
|
|
@ -23,7 +24,6 @@ import { AppEnv, AuthProp, Resource } from "@/back/types/global";
|
|||
import { DocumentTagModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -49,9 +49,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<DocumentTagModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<DocumentTagModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "color",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import {
|
|||
import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
||||
import DetailsTable from "@/back/Components/Table/DetailsTable";
|
||||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedDocumentList from "@/back/Components/Documents/AssociatedDocumentList";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import {
|
||||
|
|
@ -25,9 +28,6 @@ import { DocumentTagModel } from "@/back/types/others";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedDocumentList from "@/back/Components/Documents/AssociatedDocumentList";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (appEnv: AppEnv) => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -46,9 +46,9 @@ const getColumns = (appEnv: AppEnv) => {
|
|||
header: str(GetTranslation("validation.attributes.name"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "slug",
|
||||
|
|
|
|||
|
|
@ -27,14 +27,13 @@ import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton
|
|||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import DynamicStatusBadge from "@/back/Components/DynamicPages/DynamicStatusBadge";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { AppEnv, AuthProp, Resource } from "@/back/types/global";
|
||||
import { DynamicPageModel, PageConfigModel } from "@/back/types/dynamic-pages";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (
|
||||
appEnv: AppEnv,
|
||||
|
|
@ -67,9 +66,7 @@ const getColumns = (
|
|||
),
|
||||
cell: ({ row }: { row: Row<DynamicPageModel> }) => (
|
||||
<div className="flex justify-center items-center">
|
||||
{RenderTranslationCell(
|
||||
row.getValue("title") as TranslationField,
|
||||
)}
|
||||
<RenderTranslationCell value={row.getValue("title")} />
|
||||
{row.original.isRoot && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import DetailsTable from "@/back/Components/Table/DetailsTable";
|
|||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import DynamicStatusBadge from "@/back/Components/DynamicPages/DynamicStatusBadge";
|
||||
import RecursiveContent from "@/back/Components/DynamicPages/DynamicPageDetails";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AppEnv, AuthProp, SingleResource } from "@/back/types/global";
|
||||
|
|
@ -26,8 +28,6 @@ import {
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (
|
||||
appEnv: AppEnv,
|
||||
|
|
@ -51,8 +51,9 @@ const getColumns = (
|
|||
header: str(GetTranslation("validation.attributes.title"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) =>
|
||||
RenderTranslationCell(value),
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "parent_page",
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton
|
|||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import NewsStatusBadge from "@/back/Components/News/NewsStatusBadge";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AppEnv, AuthProp, Resource } from "@/back/types/global";
|
||||
import { NewsModel, NewsCategoryModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (appEnv: AppEnv, viewAnyNewsCategories: boolean) => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -51,9 +51,9 @@ const getColumns = (appEnv: AppEnv, viewAnyNewsCategories: boolean) => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<NewsModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("title"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<NewsModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("title")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "categories",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import { Badge } from "@/components/ui/badge";
|
|||
import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
||||
import DetailsTable from "@/back/Components/Table/DetailsTable";
|
||||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import NewsStatusBadge from "@/back/Components/News/NewsStatusBadge";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AppEnv, AuthProp, SingleResource } from "@/back/types/global";
|
||||
|
|
@ -19,10 +22,7 @@ import {
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import NewsStatusBadge from "@/back/Components/News/NewsStatusBadge";
|
||||
import useLocale from "@/store/use-locale-store";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (
|
||||
appEnv: AppEnv,
|
||||
|
|
@ -73,9 +73,9 @@ const getColumns = (
|
|||
header: str(GetTranslation("validation.attributes.title"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "slug",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import DataTable from "@/back/Components/Table/DataTable";
|
|||
import DataTableSearch from "@/back/Components/Table/DataTableSearch";
|
||||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
|
|
@ -18,7 +19,6 @@ import { AuthProp, Resource } from "@/back/types/global";
|
|||
import { NewsCategoryModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -44,9 +44,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<NewsCategoryModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<NewsCategoryModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "news",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import { Badge } from "@/components/ui/badge";
|
|||
import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
||||
import DetailsTable from "@/back/Components/Table/DetailsTable";
|
||||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedNewsList from "@/back/Components/News/AssociatedNewsList";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import {
|
||||
|
|
@ -20,9 +23,6 @@ import { NewsCategoryModel } from "@/back/types/others";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedNewsList from "@/back/Components/News/AssociatedNewsList";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (appEnv: AppEnv) => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -41,9 +41,9 @@ const getColumns = (appEnv: AppEnv) => {
|
|||
header: str(GetTranslation("validation.attributes.name"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "slug",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import DataTable from "@/back/Components/Table/DataTable";
|
|||
import DataTableSearch from "@/back/Components/Table/DataTableSearch";
|
||||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
|
|
@ -23,7 +24,6 @@ import { AuthProp, Resource } from "@/back/types/global";
|
|||
import { NewsTagModel } from "@/back/types/others";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -49,9 +49,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<NewsTagModel> }) => {
|
||||
return RenderTranslationCell(row.getValue("name"));
|
||||
},
|
||||
cell: ({ row }: { row: Row<NewsTagModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("name")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "color",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import {
|
|||
import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
||||
import DetailsTable from "@/back/Components/Table/DetailsTable";
|
||||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedNewsList from "@/back/Components/News/AssociatedNewsList";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import {
|
||||
|
|
@ -25,9 +28,6 @@ import { NewsTagModel } from "@/back/types/others";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import AssociatedNewsList from "@/back/Components/News/AssociatedNewsList";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (appEnv: AppEnv) => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -46,9 +46,9 @@ const getColumns = (appEnv: AppEnv) => {
|
|||
header: str(GetTranslation("validation.attributes.name"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "slug",
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ export default function Form({
|
|||
if (isEmpty && selectedConfig !== null) {
|
||||
setSelectedConfig(null);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [data.config]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -140,6 +141,7 @@ export default function Form({
|
|||
.value();
|
||||
setData("config", model?.config[lowerSelectedLocale] ?? []);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedConfig]);
|
||||
|
||||
return (
|
||||
|
|
@ -231,7 +233,7 @@ export default function Form({
|
|||
className="w-[var(--radix-select-trigger-width)]"
|
||||
>
|
||||
{otherConfigs.map(([configLocale, config]) => {
|
||||
configLocale = str(configLocale)
|
||||
const strConfigLocale = str(configLocale)
|
||||
.upperCase()
|
||||
.value();
|
||||
const localeFields = Object.values(config)
|
||||
|
|
@ -239,12 +241,12 @@ export default function Form({
|
|||
.join(", ");
|
||||
return (
|
||||
<SelectItem
|
||||
key={configLocale}
|
||||
value={configLocale}
|
||||
key={strConfigLocale}
|
||||
value={strConfigLocale}
|
||||
className="truncate"
|
||||
title={`${configLocale}: ${localeFields}`}
|
||||
title={`${strConfigLocale}: ${localeFields}`}
|
||||
>
|
||||
<b>{configLocale}:</b>{" "}
|
||||
<b>{strConfigLocale}:</b>{" "}
|
||||
{localeFields}
|
||||
</SelectItem>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,14 +12,13 @@ import DataTableSearch from "@/back/Components/Table/DataTableSearch";
|
|||
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
|
||||
import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AuthProp, Resource } from "@/back/types/global";
|
||||
import { PageConfigModel } from "@/back/types/dynamic-pages";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = () => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -43,11 +42,9 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<PageConfigModel> }) => {
|
||||
return RenderTranslationCell(
|
||||
row.getValue("label") as TranslationField,
|
||||
);
|
||||
},
|
||||
cell: ({ row }: { row: Row<PageConfigModel> }) => (
|
||||
<RenderTranslationCell value={row.getValue("label")} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "view",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
|||
import DetailsTable from "@/back/Components/Table/DetailsTable";
|
||||
import ModelActions from "@/back/Components/ModelActions";
|
||||
import ConfigDetails from "@/back/Components/PageConfigs/ConfigDetails";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { Views } from "@/lib/utils";
|
||||
import { useFormatedDate } from "@/hooks/use-formated-value";
|
||||
import { AppEnv, AuthProp, SingleResource } from "@/back/types/global";
|
||||
|
|
@ -16,8 +18,6 @@ import { ConfigField, PageConfigModel } from "@/back/types/dynamic-pages";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
|
||||
import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip";
|
||||
import RenderTranslationCell from "@/back/Components/RenderTranslationCell";
|
||||
|
||||
const getColumns = (appEnv: AppEnv) => {
|
||||
const GetTranslation = (name: string, options?: UseTransOptions) => {
|
||||
|
|
@ -36,9 +36,9 @@ const getColumns = (appEnv: AppEnv) => {
|
|||
header: str(GetTranslation("validation.custom.label"))
|
||||
.ucFirst()
|
||||
.value(),
|
||||
cell: ({ value }: { value: TranslationField }) => {
|
||||
return RenderTranslationCell(value);
|
||||
},
|
||||
cell: ({ value }: { value: TranslationField }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "view",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue