Skip to content

Commit e5ff59e

Browse files
authored
feat: use slugs in ui (#45)
1 parent ea31049 commit e5ff59e

File tree

4 files changed

+69
-33
lines changed

4 files changed

+69
-33
lines changed

pnpm-workspace.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
packages:
2-
- '.'
2+
- .
33

44
onlyBuiltDependencies:
55
- electron
66
- esbuild
7-

src/renderer/components/TaskDetail.tsx

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -215,31 +215,42 @@ export function TaskDetail({ task: initialTask }: TaskDetailProps) {
215215
<Box width="50%" className="border-gray-6 border-r" overflowY="auto">
216216
<Box p="4">
217217
<Flex direction="column" gap="4">
218-
<Controller
219-
name="title"
220-
control={control}
221-
render={({ field }) => (
222-
<Heading
223-
size="5"
224-
contentEditable
225-
suppressContentEditableWarning
226-
ref={(el) => {
227-
if (el && el.textContent !== field.value) {
228-
el.textContent = field.value;
229-
}
230-
}}
231-
onBlur={(e) => {
232-
field.onChange(e.currentTarget.textContent || "");
233-
onSubmit();
234-
}}
235-
style={{
236-
cursor: "text",
237-
outline: "none",
238-
width: "100%",
239-
}}
240-
/>
241-
)}
242-
/>
218+
<Flex direction="row" gap="2" align="baseline">
219+
<Code
220+
size="3"
221+
color="gray"
222+
variant="ghost"
223+
style={{ flexShrink: 0 }}
224+
>
225+
{task.slug}
226+
</Code>
227+
<Controller
228+
name="title"
229+
control={control}
230+
render={({ field }) => (
231+
<Heading
232+
size="5"
233+
contentEditable
234+
suppressContentEditableWarning
235+
ref={(el) => {
236+
if (el && el.textContent !== field.value) {
237+
el.textContent = field.value;
238+
}
239+
}}
240+
onBlur={(e) => {
241+
field.onChange(e.currentTarget.textContent || "");
242+
onSubmit();
243+
}}
244+
style={{
245+
cursor: "text",
246+
outline: "none",
247+
flex: 1,
248+
minWidth: 0,
249+
}}
250+
/>
251+
)}
252+
/>
253+
</Flex>
243254

244255
<Flex direction="column">
245256
<Controller

src/renderer/components/TaskItem.tsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CopyIcon, TrashIcon } from "@radix-ui/react-icons";
2-
import { Badge, Box, ContextMenu, Flex, Text } from "@radix-ui/themes";
2+
import { Badge, Box, Code, ContextMenu, Flex, Text } from "@radix-ui/themes";
33
import type { Task } from "@shared/types";
44
import { formatDistanceToNow } from "date-fns";
55
import type React from "react";
@@ -182,30 +182,54 @@ function TaskItemComponent({
182182
{showBottomIndicator && (
183183
<Box className="absolute right-0 bottom-0 left-0 z-10 h-0.5 bg-accent-8" />
184184
)}
185-
<Flex align="center" gap="2">
186-
<Text color="gray" size="1">
185+
<Flex align="baseline" gap="2" style={{ minWidth: 0 }}>
186+
<Text color="gray" size="1" style={{ flexShrink: 0 }}>
187187
{isHighlighted ? "[•]" : "[ ]"}
188188
</Text>
189189

190-
<Badge color={status === "Backlog" ? "gray" : undefined} size="1">
190+
<Code
191+
size="1"
192+
color="gray"
193+
variant="ghost"
194+
style={{ flexShrink: 0 }}
195+
>
196+
{task.slug}
197+
</Code>
198+
199+
<Badge
200+
color={status === "Backlog" ? "gray" : undefined}
201+
size="1"
202+
style={{ flexShrink: 0 }}
203+
>
191204
{status}
192205
</Badge>
193206

194207
<Text
195208
size="2"
196209
className="flex-1 overflow-hidden text-ellipsis whitespace-nowrap"
210+
style={{ minWidth: 0 }}
197211
>
198212
{task.title}
199213
</Text>
200214

201215
{task.repository_config && (
202-
<Text size="1" color="gray">
216+
<Text
217+
size="1"
218+
color="gray"
219+
className="whitespace-nowrap"
220+
style={{ flexShrink: 0 }}
221+
>
203222
{task.repository_config.organization}/
204223
{task.repository_config.repository}
205224
</Text>
206225
)}
207226

208-
<Text size="1" color="gray" className="whitespace-nowrap">
227+
<Text
228+
size="1"
229+
color="gray"
230+
className="whitespace-nowrap"
231+
style={{ flexShrink: 0 }}
232+
>
209233
{timeAgo}
210234
</Text>
211235
</Flex>

src/shared/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export interface RepositoryConfig {
55

66
export interface Task {
77
id: string;
8+
task_number: number | null;
9+
slug: string;
810
title: string;
911
description: string;
1012
created_at: string;

0 commit comments

Comments
 (0)