mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
feat(todo): the phone's task list takes the look of the packing list
The progress card says how many tasks are done with a slim bar, a round "+" for a new task and a "..." for the order and the lists; the filters sit in one tinted track, with "Mine" kept short there; and the tasks are rows of one card, with priority and due date under the name and the assignee's face.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { useState } from 'react'
|
||||
import { useState, type ReactNode } from 'react'
|
||||
import { selectionHaptic } from '../../../../native/haptics'
|
||||
import { Calendar, Check, ChevronRight, Flag, Pencil, Plus, RotateCcw, Trash2 } from 'lucide-react'
|
||||
import { Calendar, Check, Flag, MoreHorizontal, Pencil, Plus, RotateCcw, Trash2 } from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
import { FormSheetBody, FormSheetHeader } from '../sheets/PlSheetChrome'
|
||||
import MDancingTrek from '../../../components/MDancingTrek'
|
||||
import MChipStrip from '../../../components/MChipStrip'
|
||||
import MSwipeRow, { type SwipeAction } from '../../../components/MSwipeRow'
|
||||
@@ -10,7 +12,7 @@ import { avatarSrc } from '../../../../utils/avatarSrc'
|
||||
import { formatDate } from '../../../../utils/formatters'
|
||||
import type { TodoItem, TripMember } from '../../../../types'
|
||||
import type { TripPlanner } from '../MTripShell'
|
||||
import { CardGrid, TabPanes } from './tabChrome'
|
||||
import { TabPanes } from './tabChrome'
|
||||
import MTodoSidebar from './MTodoSidebar'
|
||||
import { useIsSplit } from '../../../../hooks/sizeClass'
|
||||
import { PRIORITY_COLOR, PRIORITY_LABEL } from './listsModel'
|
||||
@@ -20,11 +22,10 @@ import MTaskSheet from './MTaskSheet'
|
||||
import MarkdownText from '../../../../components/shared/MarkdownText'
|
||||
|
||||
/**
|
||||
* To-do sub-tab (spec 03 §4.5-4.7): progress card with "New task", the
|
||||
* All|My|Overdue|Done + priority-sort filter row (extended with a category
|
||||
* rail — the demo leaves it out, but the audit at 03 §4.8 flags "Task
|
||||
* lists/category filter" as missing and to be added), and the task cards.
|
||||
* Add/Edit lives in `MTaskSheet`.
|
||||
* To-do sub-tab, in the look of the packing list beside it: a progress card
|
||||
* with a round "+" for a new task and a "..." for the order and the lists, the
|
||||
* All|My|Overdue|Done switch in one tinted track, and the tasks as rows of one
|
||||
* card. Add/Edit lives in `MTaskSheet`.
|
||||
*/
|
||||
export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
const { t, toast, tripId, todoItems: items, tripActions } = planner
|
||||
@@ -38,6 +39,7 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
useTodoView(items, currentUserId, { rankByStatus: true, pinToday: true })
|
||||
const [editingItemId, setEditingItemId] = useState<number | null>(null)
|
||||
const [creatingTask, setCreatingTask] = useState(false)
|
||||
const [optionsOpen, setOptionsOpen] = useState(false)
|
||||
// With room for two panes the filters become a pane of their own (MTodoSidebar).
|
||||
const split = useIsSplit()
|
||||
|
||||
@@ -57,8 +59,13 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
}
|
||||
|
||||
const filterPill = (active: boolean) =>
|
||||
`flex flex-none items-center gap-[5px] whitespace-nowrap rounded-full px-[11px] py-[6px] text-[0.71875rem] font-semibold ${
|
||||
active ? 'bg-m-act text-m-actfg' : 'bg-[color:var(--m-ic)] text-m-ink'
|
||||
`flex flex-none items-center gap-[5px] whitespace-nowrap rounded-full px-[11px] py-[6px] text-caption font-semibold ${
|
||||
active ? 'bg-m-act text-m-actfg' : 'bg-m-ic text-m-ink'
|
||||
}`
|
||||
// The switch above the list: segments in one track, like Shared | My list.
|
||||
const segment = (on: boolean) =>
|
||||
`flex flex-none items-center gap-[5px] whitespace-nowrap rounded-full px-[12px] py-[6px] text-caption font-semibold ${
|
||||
on ? 'bg-m-act text-m-actfg' : 'text-m-ink'
|
||||
}`
|
||||
|
||||
const filterLabel = (f: TodoSmartFilter) =>
|
||||
@@ -90,26 +97,38 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
)
|
||||
|
||||
const progressCard = (
|
||||
/* ── Progress card (spec §4.5) ── */
|
||||
<div className="rounded-2xl border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[14px] py-[13px]">
|
||||
<div className="flex items-baseline gap-[7px]">
|
||||
<span className="font-geist text-[1rem] font-extrabold tabular-nums text-m-ink">{counts.done}/{items.length}</span>
|
||||
<span className="font-geist text-[0.625rem] font-bold text-m-faint">{pct}% {t('todo.completed')}</span>
|
||||
{canEdit && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={openCreate}
|
||||
className="ms-auto flex items-center gap-1 rounded-full bg-m-act px-[12px] py-[5px] text-[0.6875rem] font-semibold text-m-actfg"
|
||||
>
|
||||
<Plus size={11} strokeWidth={2.4} />
|
||||
{t('todo.newItem')}
|
||||
</button>
|
||||
)}
|
||||
// The packing list's card: how far along, a slim bar, the rest and the add.
|
||||
<div className="flex items-center gap-[10px] rounded-2xl border border-m-rowbr bg-m-sheetop px-[14px] py-[12px]">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="text-caption font-semibold tabular-nums text-m-ink">
|
||||
{items.length > 0 && pct === 100 ? t('todo.allDone') : t('todo.progressCount', { done: counts.done, total: items.length })}
|
||||
</div>
|
||||
<div className="mt-[9px] h-[5px] overflow-hidden rounded-full bg-[color:var(--m-ic)]">
|
||||
<div className="h-full rounded-full" style={{ width: `${pct}%`, background: 'var(--m-st-confirmed)' }} />
|
||||
<div className="mt-[7px] h-[5px] overflow-hidden rounded-full bg-m-ic">
|
||||
<div className="h-full rounded-full bg-m-act" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
</div>
|
||||
{items.length > 0 && !split && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOptionsOpen(true)}
|
||||
aria-label={t('todo.sidebar.sortBy')}
|
||||
aria-haspopup="dialog"
|
||||
className="flex h-9 w-9 flex-none items-center justify-center rounded-full bg-m-ic text-m-ink"
|
||||
>
|
||||
<MoreHorizontal size={17} strokeWidth={2.2} />
|
||||
</button>
|
||||
)}
|
||||
{canEdit && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={openCreate}
|
||||
aria-label={t('todo.newItem')}
|
||||
className="flex h-9 w-9 flex-none items-center justify-center rounded-full bg-m-act text-m-actfg"
|
||||
>
|
||||
<Plus size={18} strokeWidth={2.4} />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
@@ -144,33 +163,24 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Filters (spec §4.6) ── */}
|
||||
{/* ── Which tasks: one track, like the packing list's switch ── */}
|
||||
{!split && items.length > 0 && (
|
||||
<MChipStrip className="mt-[10px] items-center gap-[6px] whitespace-nowrap">
|
||||
<MChipStrip className="mt-[10px] gap-[2px] whitespace-nowrap rounded-full bg-m-ic p-[3px]">
|
||||
{TODO_SMART_FILTERS.map(f => (
|
||||
<button
|
||||
key={f}
|
||||
type="button"
|
||||
aria-pressed={active.kind === 'smart' && active.id === f}
|
||||
onClick={() => setActive({ kind: 'smart', id: f })}
|
||||
className={filterPill(active.kind === 'smart' && active.id === f)}
|
||||
className={segment(active.kind === 'smart' && active.id === f)}
|
||||
>
|
||||
{filterLabel(f)}
|
||||
<span className="font-geist text-[0.5625rem] opacity-70">{filterCount(f)}</span>
|
||||
</button>
|
||||
))}
|
||||
{sortPills}
|
||||
{categories.length > 0 && <span className="h-4 w-px flex-none bg-[color:var(--m-rowbr)]" />}
|
||||
{categories.map(cat => (
|
||||
<button
|
||||
key={cat}
|
||||
type="button"
|
||||
onClick={() => setActive({ kind: 'category', name: cat })}
|
||||
className={filterPill(active.kind === 'category' && active.name === cat)}
|
||||
>
|
||||
{cat}
|
||||
<span className="font-geist text-[0.5625rem] opacity-70">{catCount(cat)}</span>
|
||||
{f === 'my' ? t('todo.filter.myShort') : filterLabel(f)}
|
||||
<span className="text-caption tabular-nums opacity-60">{filterCount(f)}</span>
|
||||
</button>
|
||||
))}
|
||||
{active.kind === 'category' && (
|
||||
<button type="button" aria-pressed onClick={() => setOptionsOpen(true)} className={segment(true)}>{active.name}</button>
|
||||
)}
|
||||
</MChipStrip>
|
||||
)}
|
||||
|
||||
@@ -185,7 +195,7 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
{t('todo.emptyFiltered')}
|
||||
</div>
|
||||
) : (
|
||||
<CardGrid>
|
||||
<div className="mt-[10px] overflow-hidden rounded-2xl border border-m-rowbr bg-m-sheetop px-[13px] wide:mt-2">
|
||||
{rows.map(item => (
|
||||
<TaskCard
|
||||
key={item.id}
|
||||
@@ -197,10 +207,35 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
onDelete={canEdit ? deleteItem : undefined}
|
||||
/>
|
||||
))}
|
||||
</CardGrid>
|
||||
</div>
|
||||
)}
|
||||
</TabPanes>
|
||||
|
||||
{/* ── The order and the lists, as a sheet ── */}
|
||||
<MSheet open={optionsOpen} onClose={() => setOptionsOpen(false)} ariaLabel={t('todo.sidebar.sortBy')}>
|
||||
<FormSheetHeader title={t('todo.sidebar.sortBy')} onClose={() => setOptionsOpen(false)} closeLabel={t('common.close')} />
|
||||
<FormSheetBody>
|
||||
<div className="mb-3 flex flex-col overflow-hidden rounded-[16px] bg-m-ic">
|
||||
<OptionRow icon={<Flag size={16} strokeWidth={2} />} label={t('todo.priority')} on={sortBy === 'priority'} onClick={() => toggleSort('priority')} />
|
||||
<OptionRow icon={<Calendar size={16} strokeWidth={2} />} label={t('todo.detail.dueDate')} on={sortBy === 'due'} onClick={() => toggleSort('due')} />
|
||||
</div>
|
||||
{categories.length > 0 && (
|
||||
<>
|
||||
<div className="mb-[6px] ps-1 text-caption font-semibold text-m-muted">{t('todo.sidebar.categories')}</div>
|
||||
<div className="flex flex-col overflow-hidden rounded-[16px] bg-m-ic">
|
||||
{categories.map(cat => {
|
||||
const on = active.kind === 'category' && active.name === cat
|
||||
return (
|
||||
<OptionRow key={cat} label={cat} count={catCount(cat)} on={on}
|
||||
onClick={() => { setActive(on ? { kind: 'smart', id: 'all' } : { kind: 'category', name: cat }); setOptionsOpen(false) }} />
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</FormSheetBody>
|
||||
</MSheet>
|
||||
|
||||
<MTaskSheet
|
||||
planner={planner}
|
||||
open={creatingTask || editingItemId != null}
|
||||
@@ -214,6 +249,18 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
)
|
||||
}
|
||||
|
||||
function OptionRow({ icon, label, count, on, onClick }: Readonly<{ icon?: ReactNode; label: string; count?: number; on: boolean; onClick: () => void }>) {
|
||||
return (
|
||||
<button type="button" onClick={onClick} aria-pressed={on}
|
||||
className="flex w-full items-center gap-[11px] border-b border-m-rowbr px-[14px] py-[12px] text-start text-body font-medium text-m-ink last:border-b-0">
|
||||
{icon && <span className="flex flex-none">{icon}</span>}
|
||||
<span className="min-w-0 flex-1 truncate">{label}</span>
|
||||
{count != null && <span className="flex-none text-caption tabular-nums text-m-faint">{count}</span>}
|
||||
{on && <Check size={15} strokeWidth={2.4} className="flex-none" />}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
/** A swipe does what the card offers: tick it off, open it, or delete it. */
|
||||
function taskSwipeActions(
|
||||
item: TodoItem,
|
||||
@@ -256,60 +303,54 @@ function TaskCard({ item, members, today, onToggle, onOpen, onDelete }: {
|
||||
const { leading, trailing } = taskSwipeActions(item, t, onToggle, onOpen, onDelete)
|
||||
|
||||
return (
|
||||
<MSwipeRow leading={leading} trailing={trailing} surface="rounded-2xl bg-[color:var(--m-bg)]" className="mt-2 rounded-2xl">
|
||||
<div className={`flex items-start gap-[10px] rounded-2xl border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-3 py-[11px] ${done ? 'opacity-60' : ''}`}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onToggle(item.id, !done)}
|
||||
aria-label={item.name}
|
||||
aria-pressed={done}
|
||||
className={`mt-[1px] flex h-[19px] w-[19px] flex-none items-center justify-center rounded-[6px] border-[1.5px] ${
|
||||
done ? 'border-m-act bg-m-act text-m-actfg' : 'border-[color:var(--m-checkbr)] text-transparent'
|
||||
}`}
|
||||
>
|
||||
<Check size={12} strokeWidth={3} />
|
||||
</button>
|
||||
<MSwipeRow leading={leading} trailing={trailing} surface="bg-m-sheetop" inset={4} className="border-t border-m-rowbr first:border-t-0">
|
||||
<div className="flex items-start gap-[10px] py-[10px]">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onToggle(item.id, !done)}
|
||||
aria-label={item.name}
|
||||
aria-pressed={done}
|
||||
className={`flex h-[22px] w-[22px] flex-none items-center justify-center rounded-[7px] border-[1.5px] ${
|
||||
done ? 'border-m-act bg-m-act text-m-actfg' : 'border-[color:var(--m-checkbr)] text-transparent'
|
||||
}`}
|
||||
>
|
||||
<Check size={12} strokeWidth={3} />
|
||||
</button>
|
||||
|
||||
<button type="button" onClick={() => onOpen(item.id)} className="flex min-w-0 flex-1 items-start gap-[8px] text-start">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className={`truncate text-[0.8125rem] font-semibold ${done ? 'text-m-faint line-through opacity-45' : 'text-m-ink'}`}>
|
||||
{item.name}
|
||||
</div>
|
||||
{item.description && (
|
||||
<MarkdownText clamp className="mt-[1px] font-geist text-[0.625rem] text-m-faint">{item.description}</MarkdownText>
|
||||
)}
|
||||
{(item.priority > 0 || item.due_date || assignee) && (
|
||||
<div className="mt-[5px] flex flex-wrap items-center gap-[5px]">
|
||||
{item.priority > 0 && (
|
||||
<span className="inline-flex items-center gap-[3px] rounded-full bg-[color:var(--m-ic)] px-2 py-[2px] font-geist text-[0.59375rem] font-extrabold" style={{ color: prioColor }}>
|
||||
<Flag size={9} strokeWidth={2.5} />
|
||||
{PRIORITY_LABEL[item.priority]}
|
||||
</span>
|
||||
)}
|
||||
{item.due_date && (
|
||||
<span
|
||||
className={`inline-flex items-center gap-[3px] rounded-full px-2 py-[2px] font-geist text-[0.59375rem] font-bold ${
|
||||
overdue && !done ? 'bg-[rgba(214,39,59,.1)] text-[color:var(--m-st-danger)]' : 'bg-[color:var(--m-ic)] text-m-muted'
|
||||
}`}
|
||||
>
|
||||
<Calendar size={9} strokeWidth={2.2} />
|
||||
{dueLabel}
|
||||
</span>
|
||||
)}
|
||||
{assignee && (
|
||||
<span className="inline-flex items-center gap-[4px] rounded-full bg-[color:var(--m-ic)] py-[2px] ps-[3px] pe-2 font-geist text-[0.59375rem] font-bold text-m-muted">
|
||||
<span className="flex h-[13px] w-[13px] flex-none items-center justify-center overflow-hidden rounded-full bg-m-act text-[0.4375rem] font-extrabold text-m-actfg">
|
||||
{avatarSrcUrl ? <img src={avatarSrcUrl} alt="" className="h-full w-full object-cover" /> : assignee.username[0]?.toUpperCase()}
|
||||
</span>
|
||||
{assignee.username}
|
||||
</span>
|
||||
)}
|
||||
{/* The rest of the row opens the task sheet, like a packing row opens its item. */}
|
||||
<button type="button" onClick={() => onOpen(item.id)} aria-haspopup="dialog"
|
||||
className="flex min-w-0 flex-1 items-start gap-[8px] rounded-[10px] text-start outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-m-act">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className={`truncate pt-[1px] text-body font-medium ${done ? 'text-m-faint line-through opacity-45' : 'text-m-ink'}`}>
|
||||
{item.name}
|
||||
</div>
|
||||
{item.description && (
|
||||
<MarkdownText clamp className="mt-[1px] text-caption text-m-faint">{item.description}</MarkdownText>
|
||||
)}
|
||||
{(item.priority > 0 || item.due_date) && (
|
||||
<div className="mt-[3px] flex flex-wrap items-center gap-x-[10px] gap-y-[2px] text-caption font-semibold">
|
||||
{item.priority > 0 && (
|
||||
<span className="inline-flex items-center gap-[3px]" style={{ color: prioColor }}>
|
||||
<Flag size={11} strokeWidth={2.4} />
|
||||
{PRIORITY_LABEL[item.priority]}
|
||||
</span>
|
||||
)}
|
||||
{item.due_date && (
|
||||
<span className={`inline-flex items-center gap-[3px] ${overdue && !done ? 'text-[color:var(--m-st-danger)]' : 'text-m-muted'}`}>
|
||||
<Calendar size={11} strokeWidth={2.2} />
|
||||
{dueLabel}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{assignee && (
|
||||
<span aria-label={assignee.username} className="mt-[1px] flex h-5 w-5 flex-none items-center justify-center overflow-hidden rounded-full bg-m-ic text-[0.5625rem] font-bold text-m-muted">
|
||||
{avatarSrcUrl ? <img src={avatarSrcUrl} alt="" className="h-full w-full object-cover" /> : assignee.username[0]?.toUpperCase()}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<ChevronRight size={14} strokeWidth={2} className="mt-[2px] flex-none text-m-faint" />
|
||||
</button>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</MSwipeRow>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -67,6 +67,11 @@ function sheet() {
|
||||
return screen.getByTestId('task-sheet')
|
||||
}
|
||||
|
||||
/** The order and the lists live in a sheet behind the progress card's "...". */
|
||||
function openOptions() {
|
||||
fireEvent.click(screen.getByRole('button', { name: 'todo.sidebar.sortBy' }))
|
||||
}
|
||||
|
||||
/** Row order, read off the check buttons — they are the only ones carrying the task name as aria-label. */
|
||||
function rowOrder(names: string[]) {
|
||||
return screen
|
||||
@@ -85,16 +90,19 @@ describe('MTodoListTab', () => {
|
||||
setup([])
|
||||
|
||||
expect(screen.getByText('todo.empty')).toBeInTheDocument()
|
||||
expect(screen.getByText('0/0')).toBeInTheDocument()
|
||||
expect(screen.getByText('0% todo.completed')).toBeInTheDocument()
|
||||
expect(screen.getByText('todo.progressCount:0,0')).toBeInTheDocument()
|
||||
expect(screen.queryByRole('button', { name: /todo.filter.all/ })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-TODO-002: reports done/total and the completion percentage', () => {
|
||||
setup([todo({ id: 1 }), todo({ id: 2, checked: 1 }), todo({ id: 3, checked: 1 }), todo({ id: 4 })])
|
||||
|
||||
expect(screen.getByText('2/4')).toBeInTheDocument()
|
||||
expect(screen.getByText('50% todo.completed')).toBeInTheDocument()
|
||||
expect(screen.getByText('todo.progressCount:2,4')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-TODO-002b: everything done reads as done', () => {
|
||||
setup([todo({ id: 1, checked: 1 })])
|
||||
expect(screen.getByText('todo.allDone')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-TODO-003: hides "new task" without packing_edit', () => {
|
||||
@@ -113,7 +121,7 @@ describe('MTodoListTab', () => {
|
||||
])
|
||||
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.all3' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.my1' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.myShort1' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.overdue1' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.done1' })).toBeInTheDocument()
|
||||
})
|
||||
@@ -150,7 +158,7 @@ describe('MTodoListTab', () => {
|
||||
seedStore(useAuthStore, { user: null })
|
||||
setup([todo({ id: 1, name: 'Mine', assigned_user_id: ME })])
|
||||
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.my0' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'todo.filter.myShort0' })).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /todo.filter.my/ }))
|
||||
|
||||
@@ -174,6 +182,7 @@ describe('MTodoListTab', () => {
|
||||
|
||||
expect(rowOrder(['Low', 'High'])).toEqual(['Low', 'High'])
|
||||
|
||||
openOptions()
|
||||
const sortButton = screen.getByRole('button', { name: /todo.priority/ })
|
||||
expect(sortButton).toHaveAttribute('aria-pressed', 'false')
|
||||
fireEvent.click(sortButton)
|
||||
@@ -191,6 +200,7 @@ describe('MTodoListTab', () => {
|
||||
|
||||
expect(rowOrder(['Later', 'Sooner', 'Undated'])).toEqual(['Later', 'Sooner', 'Undated'])
|
||||
|
||||
openOptions()
|
||||
const sortButton = screen.getByRole('button', { name: /todo.detail.dueDate/ })
|
||||
expect(sortButton).toHaveAttribute('aria-pressed', 'false')
|
||||
fireEvent.click(sortButton)
|
||||
@@ -219,6 +229,7 @@ describe('MTodoListTab', () => {
|
||||
todo({ id: 2, name: 'Boots', category: 'Gear' }),
|
||||
])
|
||||
|
||||
openOptions()
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Gear1' }))
|
||||
|
||||
expect(rowOrder(['Packed', 'Boots'])).toEqual(['Boots', 'Packed'])
|
||||
@@ -231,10 +242,13 @@ describe('MTodoListTab', () => {
|
||||
todo({ id: 3, name: 'Boots', category: 'Gear' }),
|
||||
])
|
||||
|
||||
openOptions()
|
||||
expect(screen.getByRole('button', { name: 'Admin1' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'Gear1' })).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Admin1' }))
|
||||
// The chosen list shows in the switch and opens the sheet again.
|
||||
expect(screen.getByRole('button', { name: 'Admin', pressed: true })).toBeInTheDocument()
|
||||
|
||||
// the category bucket keeps done items visible
|
||||
expect(screen.getByText('Visa')).toBeInTheDocument()
|
||||
@@ -272,14 +286,14 @@ describe('MTodoListTab', () => {
|
||||
expect(screen.getByText('Direct if possible')).toBeInTheDocument()
|
||||
expect(screen.getByText('P1')).toBeInTheDocument()
|
||||
expect(screen.getByText(/Jan/)).toBeInTheDocument()
|
||||
expect(screen.getByText('lea')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('lea')).toBeInTheDocument()
|
||||
expect(document.querySelector('img[src="/uploads/avatars/lea.png"]')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-TODO-014: falls back to the username initial when a member has no avatar', () => {
|
||||
setup([todo({ id: 3, due_date: FUTURE, assigned_user_id: ME })])
|
||||
|
||||
expect(screen.getByText('maurice')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('maurice')).toBeInTheDocument()
|
||||
expect(screen.getByText('M')).toBeInTheDocument()
|
||||
expect(document.querySelector('img')).toBeNull()
|
||||
})
|
||||
@@ -301,6 +315,7 @@ describe('MTodoListTab', () => {
|
||||
it('FE-MOB-TODO-016: seeds the new task with the active category filter', () => {
|
||||
setup([todo({ id: 3, name: 'Visa', category: 'Admin' })])
|
||||
|
||||
openOptions()
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Admin1' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: /todo.newItem/ }))
|
||||
|
||||
@@ -323,6 +338,7 @@ describe('MTodoListTab', () => {
|
||||
todo({ id: 3, name: 'Boots' }),
|
||||
])
|
||||
|
||||
openOptions()
|
||||
fireEvent.click(screen.getByRole('button', { name: 'done1' }))
|
||||
|
||||
expect(screen.getByText('Visa')).toBeInTheDocument()
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'الأولوية',
|
||||
'todo.detail.noPriority': 'لا شيء',
|
||||
'todo.detail.create': 'إنشاء مهمة',
|
||||
'todo.progressCount': 'تم {done} من {total}',
|
||||
'todo.allDone': 'تم كل شيء!',
|
||||
'todo.filter.myShort': 'مهامي',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioritet',
|
||||
'todo.detail.noPriority': 'Heç biri',
|
||||
'todo.detail.create': 'Tapşırıq yarat',
|
||||
'todo.progressCount': '{total} tapşırıqdan {done} tamamlandı',
|
||||
'todo.allDone': 'Hamısı tamamlandı!',
|
||||
'todo.filter.myShort': 'Mənim',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioridade',
|
||||
'todo.detail.noPriority': 'Nenhuma',
|
||||
'todo.sortByPrio': 'Prioridade',
|
||||
'todo.progressCount': '{done} de {total} concluídas',
|
||||
'todo.allDone': 'Tudo concluído!',
|
||||
'todo.filter.myShort': 'Minhas',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.noPriority': 'Cap',
|
||||
'todo.sortByPrio': 'Prioritat',
|
||||
'todo.emptyFiltered': 'Cap tasca coincideix amb aquest filtre',
|
||||
'todo.progressCount': '{done} de {total} fetes',
|
||||
'todo.allDone': 'Tot fet!',
|
||||
'todo.filter.myShort': 'Meves',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priorita',
|
||||
'todo.detail.noPriority': 'Žádná',
|
||||
'todo.sortByPrio': 'Priorita',
|
||||
'todo.progressCount': '{done} z {total} hotovo',
|
||||
'todo.allDone': 'Vše hotovo!',
|
||||
'todo.filter.myShort': 'Moje',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priorität',
|
||||
'todo.detail.noPriority': 'Keine',
|
||||
'todo.detail.create': 'Aufgabe erstellen',
|
||||
'todo.progressCount': '{done} von {total} erledigt',
|
||||
'todo.allDone': 'Alles erledigt!',
|
||||
'todo.filter.myShort': 'Meine',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priority',
|
||||
'todo.detail.noPriority': 'None',
|
||||
'todo.detail.create': 'Create task',
|
||||
'todo.progressCount': '{done} of {total} done',
|
||||
'todo.allDone': 'All done!',
|
||||
'todo.filter.myShort': 'Mine',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioridad',
|
||||
'todo.detail.noPriority': 'Ninguna',
|
||||
'todo.sortByPrio': 'Prioridad',
|
||||
'todo.progressCount': '{done} de {total} hechas',
|
||||
'todo.allDone': '¡Todo hecho!',
|
||||
'todo.filter.myShort': 'Mías',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Tähtsus',
|
||||
'todo.detail.noPriority': 'Puudub',
|
||||
'todo.detail.create': 'Loo ülesanne',
|
||||
'todo.progressCount': '{done}/{total} tehtud',
|
||||
'todo.allDone': 'Kõik tehtud!',
|
||||
'todo.filter.myShort': 'Minu',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priorité',
|
||||
'todo.detail.noPriority': 'Aucune',
|
||||
'todo.sortByPrio': 'Priorité',
|
||||
'todo.progressCount': '{done} sur {total} terminées',
|
||||
'todo.allDone': 'Tout est fait !',
|
||||
'todo.filter.myShort': 'Les miennes',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Προτεραιότητα',
|
||||
'todo.detail.noPriority': 'Καμία',
|
||||
'todo.detail.create': 'Δημιουργία εργασίας',
|
||||
'todo.progressCount': '{done} από {total} ολοκληρώθηκαν',
|
||||
'todo.allDone': 'Όλα έγιναν!',
|
||||
'todo.filter.myShort': 'Δικές μου',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,6 +38,9 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'עדיפות',
|
||||
'todo.detail.noPriority': 'ללא',
|
||||
'todo.detail.create': 'יצירת משימה',
|
||||
'todo.progressCount': '{done} מתוך {total} הושלמו',
|
||||
'todo.allDone': 'הכול הושלם!',
|
||||
'todo.filter.myShort': 'שלי',
|
||||
};
|
||||
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioritás',
|
||||
'todo.detail.noPriority': 'Nincs',
|
||||
'todo.sortByPrio': 'Prioritás',
|
||||
'todo.progressCount': '{done}/{total} kész',
|
||||
'todo.allDone': 'Minden kész!',
|
||||
'todo.filter.myShort': 'Enyém',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioritas',
|
||||
'todo.detail.noPriority': 'Tidak ada',
|
||||
'todo.detail.create': 'Buat tugas',
|
||||
'todo.progressCount': '{done} dari {total} selesai',
|
||||
'todo.allDone': 'Semua selesai!',
|
||||
'todo.filter.myShort': 'Milik saya',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priorità',
|
||||
'todo.detail.noPriority': 'Nessuna',
|
||||
'todo.sortByPrio': 'Priorità',
|
||||
'todo.progressCount': '{done} di {total} fatte',
|
||||
'todo.allDone': 'Tutto fatto!',
|
||||
'todo.filter.myShort': 'Mie',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': '優先度',
|
||||
'todo.detail.noPriority': 'なし',
|
||||
'todo.detail.create': 'タスクを作成',
|
||||
'todo.progressCount': '{total}件中{done}件完了',
|
||||
'todo.allDone': 'すべて完了!',
|
||||
'todo.filter.myShort': '自分',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': '우선순위',
|
||||
'todo.detail.noPriority': '없음',
|
||||
'todo.detail.create': '작업 만들기',
|
||||
'todo.progressCount': '{total}개 중 {done}개 완료',
|
||||
'todo.allDone': '모두 완료!',
|
||||
'todo.filter.myShort': '내 할 일',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioriteit',
|
||||
'todo.detail.noPriority': 'Geen',
|
||||
'todo.sortByPrio': 'Prioriteit',
|
||||
'todo.progressCount': '{done} van {total} klaar',
|
||||
'todo.allDone': 'Alles klaar!',
|
||||
'todo.filter.myShort': 'Mijn',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priorytet',
|
||||
'todo.detail.noPriority': 'Brak',
|
||||
'todo.sortByPrio': 'Priorytet',
|
||||
'todo.progressCount': '{done} z {total} zrobione',
|
||||
'todo.allDone': 'Wszystko zrobione!',
|
||||
'todo.filter.myShort': 'Moje',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Приоритет',
|
||||
'todo.detail.noPriority': 'Нет',
|
||||
'todo.sortByPrio': 'Приоритет',
|
||||
'todo.progressCount': '{done} из {total} выполнено',
|
||||
'todo.allDone': 'Всё готово!',
|
||||
'todo.filter.myShort': 'Мои',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Priorita',
|
||||
'todo.detail.noPriority': 'Žiadna',
|
||||
'todo.detail.create': 'Vytvoriť úlohu',
|
||||
'todo.progressCount': '{done} z {total} hotové',
|
||||
'todo.allDone': 'Všetko hotové!',
|
||||
'todo.filter.myShort': 'Moje',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Prioritet',
|
||||
'todo.detail.noPriority': 'Ingen',
|
||||
'todo.detail.create': 'Skapa uppgift',
|
||||
'todo.progressCount': '{done} av {total} klara',
|
||||
'todo.allDone': 'Allt klart!',
|
||||
'todo.filter.myShort': 'Mina',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'ลำดับความสำคัญ',
|
||||
'todo.detail.noPriority': 'ไม่มี',
|
||||
'todo.detail.create': 'สร้างงาน',
|
||||
'todo.progressCount': 'เสร็จ {done} จาก {total}',
|
||||
'todo.allDone': 'เสร็จทั้งหมด!',
|
||||
'todo.filter.myShort': 'ของฉัน',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Öncelik',
|
||||
'todo.detail.noPriority': 'Yok',
|
||||
'todo.detail.create': 'Görev oluştur',
|
||||
'todo.progressCount': '{total} görevden {done} tamamlandı',
|
||||
'todo.allDone': 'Hepsi tamam!',
|
||||
'todo.filter.myShort': 'Benim',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Пріоритет',
|
||||
'todo.detail.noPriority': 'Немає',
|
||||
'todo.sortByPrio': 'Пріоритет',
|
||||
'todo.progressCount': '{done} з {total} виконано',
|
||||
'todo.allDone': 'Усе готово!',
|
||||
'todo.filter.myShort': 'Мої',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': 'Sự ưu tiên',
|
||||
'todo.detail.noPriority': 'Không có',
|
||||
'todo.detail.create': 'Tạo nhiệm vụ',
|
||||
'todo.progressCount': 'Xong {done}/{total}',
|
||||
'todo.allDone': 'Đã xong hết!',
|
||||
'todo.filter.myShort': 'Của tôi',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': '優先順序',
|
||||
'todo.detail.noPriority': '無',
|
||||
'todo.detail.create': '建立任務',
|
||||
'todo.progressCount': '已完成 {done}/{total}',
|
||||
'todo.allDone': '全部完成!',
|
||||
'todo.filter.myShort': '我的',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
@@ -38,5 +38,8 @@ const todo: TranslationStrings = {
|
||||
'todo.detail.priority': '优先级',
|
||||
'todo.detail.noPriority': '无',
|
||||
'todo.sortByPrio': '优先级',
|
||||
'todo.progressCount': '已完成 {done}/{total}',
|
||||
'todo.allDone': '全部完成!',
|
||||
'todo.filter.myShort': '我的',
|
||||
};
|
||||
export default todo;
|
||||
|
||||
Reference in New Issue
Block a user