- Removed unnecessary React imports. - Adjusted package.json scripts for Electron integration. - Updated components to replace Next.js-specific imports with Electron-compatible alternatives. - Minor tsconfig.json changes for better compatibility.
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import {ChangeEvent} from 'react';
|
|
import {faTrash} from '@fortawesome/free-solid-svg-icons';
|
|
import InputField from '@/components/form/InputField';
|
|
import TexteAreaInput from '@/components/form/TexteAreaInput';
|
|
import {useTranslations} from 'next-intl';
|
|
|
|
interface ActDescriptionProps {
|
|
actId: number;
|
|
summary: string;
|
|
onUpdateSummary: (actId: number, summary: string) => void;
|
|
}
|
|
|
|
export default function ActDescription({actId, summary, onUpdateSummary}: ActDescriptionProps) {
|
|
const t = useTranslations('actComponent');
|
|
|
|
function getActSummaryTitle(actId: number): string {
|
|
switch (actId) {
|
|
case 1:
|
|
return t('act1Summary');
|
|
case 4:
|
|
return t('act4Summary');
|
|
case 5:
|
|
return t('act5Summary');
|
|
default:
|
|
return t('actSummary');
|
|
}
|
|
}
|
|
|
|
function getActSummaryPlaceholder(actId: number): string {
|
|
switch (actId) {
|
|
case 1:
|
|
return t('act1SummaryPlaceholder');
|
|
case 4:
|
|
return t('act4SummaryPlaceholder');
|
|
case 5:
|
|
return t('act5SummaryPlaceholder');
|
|
default:
|
|
return t('actSummaryPlaceholder');
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="mb-4">
|
|
<InputField
|
|
fieldName={getActSummaryTitle(actId)}
|
|
input={
|
|
<TexteAreaInput
|
|
value={summary || ''}
|
|
setValue={(e: ChangeEvent<HTMLTextAreaElement>) =>
|
|
onUpdateSummary(actId, e.target.value)
|
|
}
|
|
placeholder={getActSummaryPlaceholder(actId)}
|
|
/>
|
|
}
|
|
actionIcon={faTrash}
|
|
actionLabel={t('delete')}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|