---
phase: 02-core-crud
plan: 04
type: execute
wave: 4
depends_on: [02-03]
files_modified:
- src/lib/components/EntryCard.svelte
- package.json
autonomous: false
must_haves:
truths:
- "User can swipe left on mobile to delete an entry"
- "Touch targets are at least 44x44px"
- "UI is usable on mobile devices (tested)"
- "Delete via swipe shows confirmation before deleting"
artifacts:
- path: "src/lib/components/EntryCard.svelte"
provides: "Swipe-to-delete functionality"
contains: "svelte-gestures"
- path: "package.json"
provides: "svelte-gestures dependency"
contains: "svelte-gestures"
key_links:
- from: "src/lib/components/EntryCard.svelte"
to: "src/routes/+page.server.ts"
via: "form action ?/delete"
pattern: "action=.*\\?/delete"
---
Implement swipe-to-delete gesture for mobile and verify overall mobile UX.
Purpose: Mobile users can swipe left to delete entries (common mobile pattern). Final verification ensures all touch targets meet WCAG guidelines and UI works well on mobile.
Output: Swipe-to-delete on EntryCard, verified mobile-friendly UI.
@/home/tho/.claude/get-shit-done/workflows/execute-plan.md
@/home/tho/.claude/get-shit-done/templates/summary.md
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/02-core-crud/02-CONTEXT.md
@.planning/phases/02-core-crud/02-RESEARCH.md
@.planning/phases/02-core-crud/02-03-SUMMARY.md
@src/lib/components/EntryCard.svelte
Task 1: Install svelte-gestures and implement swipe-to-deletepackage.json, src/lib/components/EntryCard.svelte
Install svelte-gestures:
```bash
npm install svelte-gestures
```
Update EntryCard.svelte to add swipe-to-delete functionality:
1. Import the swipe action from svelte-gestures
2. Wrap the entry in a swipeable container
3. On left swipe, show confirmation then delete
4. Add visual feedback (red background revealing during swipe)
5. On desktop, keep the delete button in expanded view (swipe is touch-only)
Add to the script section:
```typescript
import { swipe } from 'svelte-gestures';
// Swipe state
let swipeOffset = $state(0);
let isConfirmingDelete = $state(false);
function handleSwipe(event: CustomEvent) {
const { direction } = event.detail;
if (direction === 'left') {
// Show confirmation
isConfirmingDelete = true;
}
}
function handleSwipeMove(event: CustomEvent) {
// Visual feedback during swipe
const { offsetX } = event.detail;
if (offsetX < 0) {
swipeOffset = Math.max(offsetX, -100); // Cap at -100px
}
}
function handleSwipeEnd() {
if (!isConfirmingDelete) {
swipeOffset = 0;
}
}
function cancelDelete() {
isConfirmingDelete = false;
swipeOffset = 0;
}
async function confirmDelete() {
const formData = new FormData();
formData.append('id', entry.id);
await fetch('?/delete', {
method: 'POST',
body: formData
});
// Refresh page to show updated list
window.location.reload();
}
```
Update the template to wrap in a swipeable container:
```svelte
{#if isConfirmingDelete}
{/if}
```
Key behaviors:
- Swipe left reveals red delete icon
- If swipe distance > 60px, show confirmation overlay
- Confirmation has Cancel and Delete buttons
- On desktop, swipe doesn't trigger (touch-only)
- Delete button in expanded view still works for desktop users
npm install completes.
TypeScript check: `npm run check` passes.
Start dev server: `npm run dev`
Open in browser dev tools mobile view:
- Swipe left on an entry
- Red background should reveal
- Release after 60px+ swipe shows confirmation
- Cancel returns to normal, Delete removes entry
Swipe-to-delete works on mobile with confirmation overlay
Complete Phase 2 UI with:
- Entry list showing tasks and thoughts
- Quick capture bar at bottom
- Inline editing with auto-save
- Swipe-to-delete on mobile
- Show/hide completed toggle
- Mobile-responsive layout
1. **Desktop verification** (http://localhost:5173):
- Create a task via quick capture - should appear in list
- Create a thought - should appear with purple indicator
- Click an entry - should expand with edit fields
- Edit title/content - should auto-save (see "Saving...")
- Mark a task complete - checkbox should fill, task may disappear
- Check "Show completed" - completed task reappears
- Delete an entry via expanded view - should prompt then remove
2. **Mobile verification** (use browser dev tools mobile mode OR actual phone):
- Quick capture bar should be at bottom, thumb-friendly
- Type selector and Add button should be reachable
- Entries should be tappable to expand
- Swipe left on an entry - red trash icon reveals
- Complete swipe - confirmation appears
- Tap Delete - entry removed
- Touch targets feel adequately sized (not too small)
- Text is readable (not tiny)
3. **Font/Accessibility**:
- Base text should be at least 16px
- No text smaller than 14px anywhere
- Buttons and checkboxes are easy to tap
Type "approved" if all checks pass, or describe any issues found
After all tasks complete:
1. **TypeScript**: `npm run check` passes
2. **Swipe gesture**: Works on mobile/touch devices
3. **Touch targets**: All interactive elements >= 44x44px
4. **Font sizes**: Base 16px, no text under 14px
5. **Mobile layout**: Compact list, bottom capture bar
6. **Desktop layout**: Card style entries, adequate spacing
Requirements satisfied:
- UX-01: Mobile-friendly ✓
- UX-02: Readable fonts ✓
- UX-03: Cross-browser (SvelteKit handles) ✓
- Swipe-to-delete works on mobile with confirmation
- All touch targets meet WCAG 44x44px minimum
- UI verified working on both desktop and mobile
- User approves the UI at checkpoint
- All Phase 2 requirements complete