Fix apps/console lint issues

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-22 12:51:08 +04:00
parent b4a73f2eea
commit dd23449cc0
244 changed files with 7685 additions and 8029 deletions

View File

@@ -75,7 +75,7 @@ const createTaskSchema = z.object({
timeEstimate: z.string().optional().nullable(),
assignedToId: z.string().optional().nullable(),
measureId: z.preprocess(
(val) => (val === "" || val == null ? null : val),
val => (val === "" || val == null ? null : val),
z.string().nullable().optional(),
),
deadline: z.string().optional().nullable(),
@@ -86,11 +86,11 @@ const updateTaskSchema = z.object({
description: z.string().optional().nullable(),
timeEstimate: z.string().optional().nullable(),
assignedToId: z.preprocess(
(val) => (val === "" || val == null ? null : val),
val => (val === "" || val == null ? null : val),
z.string().nullable().optional(),
),
measureId: z.preprocess(
(val) => (val === "" || val == null ? null : val),
val => (val === "" || val == null ? null : val),
z.string().nullable().optional(),
),
deadline: z.string().optional().nullable(),
@@ -105,11 +105,12 @@ type Props = {
};
export default function TaskFormDialog(props: Props) {
const { children, connection, ref, task: taskKey, measureId } = props;
const { __ } = useTranslate();
const ref = useDialogRef();
const dialogRef = props.ref ?? ref;
const newRef = useDialogRef();
const dialogRef = ref ?? newRef;
const organizationId = useOrganizationId();
const task = useFragment(taskFragment, props.task);
const task = useFragment(taskFragment, taskKey);
const relayEnv = useRelayEnvironment();
const [mutate] = useMutationWithToasts(
task ? taskUpdateMutation : taskCreateMutation,
@@ -121,19 +122,19 @@ export default function TaskFormDialog(props: Props) {
const isUpdating = !!task;
const { control, handleSubmit, register, formState, reset } =
useFormWithSchema(isUpdating ? updateTaskSchema : createTaskSchema, {
const { control, handleSubmit, register, formState, reset }
= useFormWithSchema(isUpdating ? updateTaskSchema : createTaskSchema, {
defaultValues: {
name: task?.name ?? "",
description: task?.description ?? "",
timeEstimate: task?.timeEstimate ?? "",
assignedToId: task?.assignedTo?.id ?? "",
measureId: task?.measure?.id ?? props.measureId ?? "",
measureId: task?.measure?.id ?? measureId ?? "",
deadline: task?.deadline?.split("T")[0] ?? "",
},
});
const onSubmit = handleSubmit(async (data) => {
const onSubmit = async (data: z.infer<typeof updateTaskSchema | typeof createTaskSchema>) => {
if (task) {
await mutate({
variables: {
@@ -160,7 +161,7 @@ export default function TaskFormDialog(props: Props) {
assignedToId: data.assignedToId || null,
measureId: data.measureId || null,
},
connections: [props.connection!],
connections: [connection!],
},
onCompleted: (_response, errors) => {
if (!errors && data.measureId) {
@@ -171,20 +172,20 @@ export default function TaskFormDialog(props: Props) {
reset();
}
dialogRef.current?.close();
});
const showMeasure = !props.measureId;
};
const showMeasure = !measureId;
return (
<Dialog
ref={dialogRef}
trigger={props.children}
title={
trigger={children}
title={(
<Breadcrumb
items={[__("Tasks"), isUpdating ? __("Edit Task") : __("New Task")]}
/>
}
)}
>
<form onSubmit={onSubmit}>
<form onSubmit={e => void handleSubmit(onSubmit)(e)}>
<DialogContent className="grid grid-cols-[1fr_420px]">
<div className="py-8 px-10 space-y-4">
<Input
@@ -240,7 +241,7 @@ export default function TaskFormDialog(props: Props) {
<DurationPicker
{...field}
value={value ?? null}
onValueChange={(value) => onChange(value)}
onValueChange={value => onChange(value)}
/>
)}
/>

View File

@@ -39,9 +39,9 @@ type Props = {
tasks:
| TasksPageFragment$data["tasks"]["edges"]
| Extract<
MeasureTasksTabQuery$data["node"],
{ __typename: "Measure" }
>["tasks"]["edges"];
MeasureTasksTabQuery$data["node"],
{ __typename: "Measure" }
>["tasks"]["edges"];
connectionId: string;
};
@@ -67,52 +67,54 @@ export function TasksCard({ tasks, connectionId }: Props) {
return (
<div className="space-y-6">
{tasks.length === 0 ? (
<p className="text-center py-6 text-txt-secondary">{__("No tasks")}</p>
) : (
<Card>
<Tabs className="px-6">
{hashes.map((h) => (
<TabItem asChild active={hash === h.hash} key={h.hash}>
<Link to={`#${h.hash}`}>
{h.label}
<TabBadge>{tasksPerHash.get(h.hash)?.length}</TabBadge>
</Link>
</TabItem>
))}
</Tabs>
<div className="divide-y divide-border-solid">
{hash === "all"
? // All tabs group the todo using the state
hashes
.slice(0, 2)
.filter((h) => tasksPerHash.get(h.hash)?.length)
.map((h) => (
<Fragment key={h.label}>
<h2 className="px-6 py-3 text-sm font-medium flex items-center gap-2 bg-subtle">
<TaskStateIcon state={h.state!} />
{h.label}
</h2>
{tasksPerHash.get(h.hash)?.map(({ node: task }) => (
<TaskRow
key={task.id}
fKey={task}
connectionId={connectionId}
/>
))}
</Fragment>
))
: // Todo and Done tab simply list todos
filteredTasks?.map(({ node: task }) => (
<TaskRow
key={task.id}
fKey={task}
connectionId={connectionId}
/>
{tasks.length === 0
? (
<p className="text-center py-6 text-txt-secondary">{__("No tasks")}</p>
)
: (
<Card>
<Tabs className="px-6">
{hashes.map(h => (
<TabItem asChild active={hash === h.hash} key={h.hash}>
<Link to={`#${h.hash}`}>
{h.label}
<TabBadge>{tasksPerHash.get(h.hash)?.length}</TabBadge>
</Link>
</TabItem>
))}
</div>
</Card>
)}
</Tabs>
<div className="divide-y divide-border-solid">
{hash === "all"
// All tabs group the todo using the state
? hashes
.slice(0, 2)
.filter(h => tasksPerHash.get(h.hash)?.length)
.map(h => (
<Fragment key={h.label}>
<h2 className="px-6 py-3 text-sm font-medium flex items-center gap-2 bg-subtle">
<TaskStateIcon state={h.state!} />
{h.label}
</h2>
{tasksPerHash.get(h.hash)?.map(({ node: task }) => (
<TaskRow
key={task.id}
fKey={task}
connectionId={connectionId}
/>
))}
</Fragment>
))
// Todo and Done tab simply list todos
: filteredTasks?.map(({ node: task }) => (
<TaskRow
key={task.id}
fKey={task}
connectionId={connectionId}
/>
))}
</div>
</Card>
)}
</div>
);
}
@@ -163,15 +165,15 @@ function TaskRow(props: TaskRowProps) {
const params = useParams<{ measureId?: string }>();
const relayEnv = useRelayEnvironment();
const { canUpdate, canDelete, ...task } =
useFragment<TasksCard_TaskRowFragment$key>(
const { canUpdate, canDelete, ...task }
= useFragment<TasksCard_TaskRowFragment$key>(
fragment,
props.fKey as TasksCard_TaskRowFragment$key,
);
const [updateTask, isUpdating] = useMutation(taskUpdateMutation);
const onToggle = () => {
promisifyMutation(updateTask)({
const onToggle = async () => {
await promisifyMutation(updateTask)({
variables: {
input: {
taskId: task.id,
@@ -217,7 +219,7 @@ function TaskRow(props: TaskRowProps) {
<div className="flex items-center gap-2 pt-[2px]">
<PriorityLevel level={1} />
<button
onClick={onToggle}
onClick={() => void onToggle()}
className="cursor-pointer -m-1 p-1 disabled:opacity-60"
disabled={isUpdating}
>
@@ -227,7 +229,7 @@ function TaskRow(props: TaskRowProps) {
<div className="text-sm space-y-1 flex-1">
<h2 className="font-medium">{task.name}</h2>
{task.description && (
<p className="text-txt-secondary whitespace-pre-wrap break-words">
<p className="text-txt-secondary whitespace-pre-wrap wrap-break-word">
{task.description}
</p>
)}