Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions web-app/src/routes/project/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createFileRoute } from '@tanstack/react-router'
import { useState, useMemo } from 'react'

Check warning on line 2 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

1-2 lines are not covered with tests

import { useThreadManagement } from '@/hooks/useThreadManagement'
import { useThreads } from '@/hooks/useThreads'
import { useTranslation } from '@/i18n/react-i18next-compat'

Check warning on line 6 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

4-6 lines are not covered with tests

import HeaderPage from '@/containers/HeaderPage'
import ThreadList from '@/containers/ThreadList'
import {

Check warning on line 10 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

8-10 lines are not covered with tests
IconCirclePlus,
IconPencil,
IconTrash,
Expand All @@ -15,45 +15,45 @@
IconChevronDown,
IconChevronRight,
} from '@tabler/icons-react'
import AddProjectDialog from '@/containers/dialogs/AddProjectDialog'
import { DeleteProjectDialog } from '@/containers/dialogs/DeleteProjectDialog'
import { Button } from '@/components/ui/button'

Check warning on line 20 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

18-20 lines are not covered with tests

import { formatDate } from '@/utils/formatDate'

Check warning on line 22 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

22 line is not covered with tests

export const Route = createFileRoute('/project/')({
component: Project,
})

Check warning on line 26 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

24-26 lines are not covered with tests

function Project() {
return <ProjectContent />
}

Check warning on line 30 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

28-30 lines are not covered with tests

function ProjectContent() {
const { t } = useTranslation()
const { folders, addFolder, updateFolder, deleteFolder, getFolderById } =
useThreadManagement()
const threads = useThreads((state) => state.threads)
const [open, setOpen] = useState(false)
const [editingKey, setEditingKey] = useState<string | null>(null)
const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false)
const [deletingId, setDeletingId] = useState<string | null>(null)
const [expandedProjects, setExpandedProjects] = useState<Set<string>>(
new Set()
)

Check warning on line 43 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

32-43 lines are not covered with tests

const handleDelete = (id: string) => {
setDeletingId(id)
setDeleteConfirmOpen(true)
}

Check warning on line 48 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

45-48 lines are not covered with tests

const confirmDelete = () => {
if (deletingId) {
deleteFolder(deletingId)
setDeleteConfirmOpen(false)
setDeletingId(null)
}
}

Check warning on line 56 in web-app/src/routes/project/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

50-56 lines are not covered with tests

const handleSave = (name: string) => {
if (editingKey) {
Expand Down Expand Up @@ -134,25 +134,22 @@
className="bg-main-view-fg/3 py-2 px-4 rounded-lg"
key={folder.id}
>
<div className="flex items-center gap-4">
<div className="flex items-start gap-3 flex-1">
<div className="flex items-center gap-4 min-w-0">
<div className="flex items-start gap-3 flex-1 min-w-0">
<div className="shrink-0 w-8 h-8 relative flex items-center justify-center bg-main-view-fg/4 rounded-md">
<IconFolder
size={16}
className="text-main-view-fg/50"
/>
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<h3 className="text-base font-medium text-main-view-fg/80 line-clamp-1">
<div className="flex-1 min-w-0 overflow-hidden">
<div className="flex items-center gap-2 min-w-0">
<h3
className="text-base font-medium text-main-view-fg/80 truncate flex-1 min-w-0"
title={folder.name}
>
{folder.name}
</h3>
<span className="text-xs bg-main-view-fg/10 text-main-view-fg/60 px-2 py-0.5 rounded-full">
{projectThreads.length}{' '}
{projectThreads.length === 1
? t('projects.thread')
: t('projects.threads')}
</span>
</div>
<p className="text-main-view-fg/50 text-xs line-clamp-2 mt-0.5">
{t('projects.updated')}{' '}
Expand All @@ -161,6 +158,12 @@
</div>
</div>
<div className="flex items-center">
<span className="text-xs mr-4 bg-main-view-fg/10 text-main-view-fg/60 px-2 py-0.5 rounded-full shrink-0 whitespace-nowrap">
{projectThreads.length}{' '}
{projectThreads.length === 1
? t('projects.thread')
: t('projects.threads')}
</span>
{projectThreads.length > 0 && (
<button
className="size-8 cursor-pointer flex items-center justify-center rounded-md hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out mr-1"
Expand Down
Loading