⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { Assignee } from '@/lib/api/endpoints/projects';
import type { IssueFieldValue, IssueFieldValueInput } from '@/lib/api/endpoints/issues';
import type { MentionSource } from '@/lib/api/endpoints/mentions';
import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
import IssueCustomFieldControl from './IssueCustomFieldControl';
import { useTranslations } from 'next-intl';
// One custom field rendered in the issue body (under the description) rather than
// as a Properties row: a heading with the field name, then the value editor. A
// markdown field uses the full markdown editor; every other type reuses the
// inline control from the Properties grid.
export default function IssueCustomFieldBody({
def,
current,
assignees,
saveKey,
uploadFile,
imageAttachments,
onSetField,
readOnly,
mentions,
}: {
def: CustomField;
current: IssueFieldValue | undefined;
assignees: Assignee[];
saveKey: string;
uploadFile?: (file: File) => Promise<Embeddable>;
imageAttachments?: Embeddable[];
onSetField: (fieldId: number, value: IssueFieldValueInput) => void;
readOnly?: boolean;
mentions?: MentionSource;
}) {
const t = useTranslations('issue.fields');
return (
<div className="mt-6">
<h3 className="mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase">
{def.name}
</h3>
{def.fieldType === 'markdown' ? (
<MarkdownEditor
defaultValue={(current?.value as string) ?? ''}
key={saveKey}
placeholder={t('empty')}
editable={!readOnly}
uploadFile={uploadFile}
imageAttachments={imageAttachments}
mentions={mentions}
onBlur={(md) => {
const next = md.trim() === '' ? null : md;
if (next !== ((current?.value as string | null) ?? null))
onSetField(def.id, { value: next });
}}
/>
) : (
<IssueCustomFieldControl
def={def}
current={current}
assignees={assignees}
saveKey={saveKey}
onChange={(value) => onSetField(def.id, value)}
readOnly={readOnly}
/>
)}
</div>
);
}