Commit graph

499 commits

Author SHA1 Message Date
Devin AI
3f5969a08c lint: remove unused imports and variables (11 fixes)
Co-Authored-By: Justin Edmund <justin@jedmund.com>
2025-11-23 14:26:56 +00:00
3a1670c096
Merge pull request #19 from jedmund/hotfix/project-loading
fix: add missing migration for project header visibility fields
2025-11-23 06:06:49 -08:00
f7d6f23b78 fix: add missing migration for project header visibility fields
Fixes P0 production error where projects failed to load due to missing
database columns. The schema was updated in commit 12d2ba1 to add three
Boolean fields (showFeaturedImageInHeader, showBackgroundColorInHeader,
showLogoInHeader) but no migration was created.

This migration adds the missing columns to the Project table with their
proper defaults (all true), resolving the "column does not exist" error
in production.
2025-11-23 06:05:42 -08:00
b06842bcab
Merge pull request #18 from jedmund/cleanup/linter
Linter cleanup Part 1
2025-11-23 05:57:49 -08:00
4ae445681e docs: update progress doc 2025-11-23 05:56:35 -08:00
6408e7f85d wip: start fixing server utility any types
- add ContentNode interface for content rendering
- replace any with proper types in content.ts (15 -> 6 errors)
- use Record<string, unknown> for dynamic content objects
- add type assertions for content arrays
2025-11-23 05:52:42 -08:00
93795577cd fix: complete frontend component any type cleanup
- replace any with Prisma types (Post, Project, Album, Media)
- use Component type for Svelte component parameters
- use Snippet type for Svelte 5 render slots
- use Record<string, unknown> for dynamic objects
- add proper type guards for error handling
- fix editor extension types with proper generics
- all frontend components now have zero any type errors
2025-11-23 05:50:22 -08:00
3d77922a99 fix: replace more any types in components
- fix edra placeholder components with proper editor context types
- fix gallery image types with proper type assertions
- fix ProseMirror transaction types in link manager
- fix command types in composer toolbar
- replace any with unknown where type is dynamic
2025-11-23 05:37:28 -08:00
9c746d51c0 fix: replace any types in frontend components
- use Leaflet types (L.Map, L.Marker, L.LeafletEvent) for map components
- use Post and Project types from Prisma for form components
- use JSONContent type for editor instances
- use Snippet type for Svelte 5 render functions
- use EditorView type for TipTap/ProseMirror views
- use proper type guards for error handling
- add editor interface types for save/clear methods
2025-11-23 05:32:09 -08:00
8ec4c582c1 fix: eliminate remaining any types in API routes
- use Prisma.JsonValue and Prisma input types throughout
- add proper type guards for array and object checks
- replace any with Record<string, unknown> where appropriate
- all API/RSS routes now have zero any type errors
2025-11-23 05:28:05 -08:00
73c2fae7b8 fix: complete API route type safety improvements
- add ProjectUpdateBody interface for partial updates
- use Prisma.ProjectUpdateInput for update operations
- replace all remaining any types in projects endpoints
- consistent use of proper types across all API routes
2025-11-23 05:16:55 -08:00
f6737ee19c fix: replace remaining any types in API routes
- add AlbumPhoto, BlockContent, AppleMusicData types
- add ProjectCreateBody interface for request validation
- use Prisma.ProjectWhereInput for query filters
- use Prisma.JsonValue for JSON fields
- add proper type guards for content validation
2025-11-23 05:14:19 -08:00
aab78f3909 fix: replace any types in API routes with proper Prisma types
- add ContentNode, GalleryItem, TextNode, ParagraphNode, DocContent types
- use Prisma.JsonValue for JSON column content
- use Prisma.ProjectUpdateInput and Prisma.PostUpdateInput for update payloads
- improve type guards for content filtering
- replace any[] with never[] for empty placeholder arrays
2025-11-23 05:04:04 -08:00
056e8927ee fix: replace any types with proper types in admin components
- add GalleryItem type for media/gallery item unions
- add EdraCommand import for editor command types
- add Post, Media imports from Prisma
- add BlockContent, DraftPayload, PostPayload, PhotoPayload types
- replace any with proper types in form handlers and callbacks
- use unknown for truly dynamic data, Record types for object props
2025-11-23 05:00:59 -08:00
94e13f1129 chore: auto-fix linting issues with eslint --fix
Apply automatic fixes for prefer-const violations and other
auto-fixable linting errors. Reduces error count from 613 to 622.
2025-11-23 04:48:06 -08:00
ec0431d2b0 fix: extract JSON-LD script generation to resolve parsing errors
Refactor inline template literals with nested JSON.stringify() into
separate derived variables. Fixes 6 ESLint parsing errors in route files.
2025-11-23 04:47:26 -08:00
d60eba6e90 fix: require pnpm >= 10 in package.json engines 2025-11-23 03:52:35 -08:00
d994a5bf96 fix: upgrade to pnpm 10 for psn-api compatibility 2025-11-23 03:50:52 -08:00
e4cc4e22c7 fix: update psn-api to use pnpm and simplify railpack config 2025-11-23 03:49:52 -08:00
59714b2d83 fix: enable corepack and install yarn before pnpm install 2025-11-23 03:41:31 -08:00
79a439c634 fix: switch to Railpack with proper pnpm and yarn configuration 2025-11-23 03:39:23 -08:00
e7c652460e fix: add yarn to nixpacks for psn-api dependency 2025-11-23 03:36:08 -08:00
e6392da856 fix: remove dev.db from git and configure Railway properly 2025-11-23 03:33:59 -08:00
aadb00dce7 fix: disable engine-strict and add nixpacks config for Railway 2025-11-23 03:30:05 -08:00
28f20de66a fix: continuing to migrate to pnpm 2025-11-23 03:25:20 -08:00
8721158da9 Update build script 2025-11-23 03:10:26 -08:00
eed50715f0
Merge pull request #16 from jedmund/cleanup/dead-code-and-modernization
Clean up dead code and modernize admin codebase
2025-11-23 03:07:01 -08:00
715322b86c chore: migrate from npm to pnpm
Removed npm's package-lock.json and added pnpm-lock.yaml as part of the package manager migration.
2025-11-23 02:56:11 -08:00
ffa5ae7f02 fix: properly render links and formatting in RSS feeds
Replace broken text extraction logic with renderEdraContent() which correctly handles TipTap marks including links, bold, italic, etc.

Before: Links were stripped from RSS content (only plain text extracted)
After: Full HTML with proper links, formatting preserved in CDATA sections

Files updated:
- src/routes/rss/+server.ts: Main RSS feed
- src/routes/rss/universe/+server.ts: Universe RSS feed

Fixes issue where content.blocks was expected but TipTap uses content.type='doc' format.
2025-11-04 20:56:26 -08:00
86b072c70f fix: convert final $: reactive statement to $effect
Replace remaining $: if statement with $effect for slug generation in InlineComposerModal.
2025-11-04 19:49:42 -08:00
5b5785887d refactor: replace $: reactive statements with $derived()
Migrate remaining Svelte 4 reactive statements to Svelte 5 $derived:
- media/audit/+page.svelte: Convert allSelected, hasSelection, selectedSize to $derived
- universe/compose/+page.svelte: Convert postType, initialContent to $derived
- Also migrated all let declarations to $state() in audit page for consistency

All reactive statements now use Svelte 5 runes mode.
2025-11-04 19:46:35 -08:00
4337b57dee refactor: migrate createEventDispatcher to Svelte 5 callback props
Migrate 5 components from Svelte 4 createEventDispatcher to Svelte 5 callback props:
- DropdownMenu.svelte (removed unused dispatcher)
- ProjectListItem.svelte (edit, togglePublish, delete events)
- PostListItem.svelte (edit, togglePublish, delete events)
- AlbumListItem.svelte (toggleDropdown, edit, togglePublish, delete events)
- InlineComposerModal.svelte (close, saved events + migrate export let to $props)

Updated parent components to use onevent={handler} syntax instead of on:event={handler}.
2025-11-04 19:35:53 -08:00
d964bf05cd chore: remove dead code and unused files
Delete completely unused files:
- album-stream.ts store (127 lines, never imported)
- AdminSegmentedController + BaseSegmentedController (546 lines, superseded by AdminSegmentedControl)
- AlbumMetadataPopover.svelte (never imported)
- 5 test/demo pages in admin routes (buttons, inputs, *-test routes)

Total cleanup: ~1,200+ lines of dead code removed
2025-11-04 19:03:50 -08:00
bc102fba0a style: remove horizontal padding from Edra editor paragraphs and headings
Remove left/right padding from p and h1-h6 elements to allow content to use full width of the editor container.
2025-11-03 23:04:05 -08:00
314885b704 feat: add utility components and helpers
Add DropdownSelectField and StatusPicker components for form inputs. Add time utility functions.
2025-11-03 23:03:50 -08:00
4df84addfa docs: add PRD for privacy-friendly analytics 2025-11-03 23:03:44 -08:00
9403cd047c feat: add sticky header with scroll shadow to admin pages
Make page headers sticky with subtle shadow on scroll. Fix min-height to 90px to prevent jumping when switching tabs. Modernize layout to use full viewport height.
2025-11-03 23:03:40 -08:00
cf2842d22d refactor: migrate admin UI to Svelte 5 runes
Convert admin components from Svelte 4 to Svelte 5 syntax using $props, $state, $derived, and $bindable runes. Simplifies AdminNavBar logic and improves type safety.
2025-11-03 23:03:28 -08:00
6ca6727eda refactor: modernize ProjectBrandingForm with reusable components
Extract BrandingToggle and BrandingSection components. Consolidate $effect blocks, add $derived state, and apply BEM naming. Reduces component size by 47% while improving maintainability.
2025-11-03 23:03:20 -08:00
12d2ba1667 feat: add branding preview with visibility toggles
Add live preview to branding form showing featured image, background color, and logo. Add database fields and toggles to control visibility of each element in project headers.
2025-11-03 23:03:13 -08:00
1190bfc62e fix: enable drag and drop reordering in Edra editor
Add return false to drop handler so ProseMirror's Dropcursor extension can handle the actual node movement. Previously the handler would intercept drops but not perform any movement.
2025-11-03 23:03:07 -08:00
78ef0c3d18 docs(admin): mark Task 7 and Phase 4 complete
All 4 phases of admin modernization complete:
- Phase 0: Runed integration 
- Phase 1: Auth & data foundation 
- Phase 2: Form modernization 
- Phase 3: List utilities & primitives 
- Phase 4: Styling harmonization 

Task 7 results:
- 3-layer theming architecture for future dark mode
- ~30 semantic SCSS variables + CSS custom properties
- EmptyState and ErrorMessage reusable components
- 4 pages refactored (projects, posts, media, albums)
- 105 lines of duplicated styles removed
- Standardized error colors and spacing across components

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 22:03:14 -07:00
1c98aff722 feat(admin): complete Task 7 Phase 2 - styling rollout
Extended the theming system to additional pages and components, continuing
to eliminate hardcoded colors and duplicated styles.

**Pages Refactored:**
- /admin/media - Integrated EmptyState with action button (~20 lines removed)
- /admin/albums - Integrated EmptyState & ErrorMessage (~25 lines removed)
  - Fixed hardcoded spacing in loading spinner (32px → calc($unit * 4))
  - Replaced hardcoded error color (#d33 → $error-text)

**Components Updated with Semantic Colors:**
- Button.svelte - Replaced 3 instances of #dc2626 → $error-text
- AlbumSelector.svelte - Error message uses $error-bg, $error-text
- AlbumSelectorModal.svelte - Error message uses $error-bg, $error-text, $error-border
  - Fixed border width (1px → $unit-1px)

**Phase 2 Results:**
- Total lines removed: ~105 across 4 pages (Phase 1: 60, Phase 2: 45)
- EmptyState component now used in 4 pages
- ErrorMessage component now used in 3 pages
- Standardized error colors across 3 modal components

**Theming Benefits:**
- Error styling centralized (change $error-bg once, updates everywhere)
- Empty states guaranteed visual consistency
- Dark mode ready (just remap CSS variables in themes.scss)

**Remaining work (future):**
- ~30 files with remaining hardcoded colors
- ~15 files with spacing that could use $unit system
- Opportunity for additional semantic variables as needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 22:02:33 -07:00
45e3556663 feat(admin): complete Task 7 Phase 1 - styling & theming foundation
Implemented a three-layer theming architecture to standardize admin component
styling and prepare for future dark mode support.

**Architecture:**
- Layer 1: Base colors ($gray-80, $red-60) in variables.scss
- Layer 2: Semantic SCSS variables ($input-bg, $error-bg) in variables.scss
- Layer 3: CSS custom properties (--input-bg, --error-bg) in themes.scss

**New semantic variables (~30 added):**
- Inputs & forms (bg, hover, focus, text, border states)
- State messages (error, success, warning with bg/text/border)
- Empty states (text, heading colors)
- Cards, dropdowns, popovers, modals (bg, border, shadow)

**New reusable components:**
- EmptyState.svelte - Supports icon and action snippets
- ErrorMessage.svelte - Supports dismissible errors

**Pages refactored:**
- /admin/projects - Uses EmptyState and ErrorMessage (~30 lines removed)
- /admin/posts - Uses EmptyState and ErrorMessage with icon (~30 lines removed)

**Benefits:**
- 60+ lines of duplicate styles removed (just 2 pages)
- Future dark mode = remap CSS variables in themes.scss only
- Guaranteed visual consistency for errors and empty states
- $unit-based spacing system enforced

**Remaining work (Phase 2):**
- Replace hardcoded colors in ~40 files
- Fix hardcoded spacing in ~20 files
- Expand EmptyState/ErrorMessage to remaining pages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 21:28:28 -07:00
48e53aea3a feat(admin): complete Task 5 dropdown primitives (Option A)
Task 5 was ~85% complete when reviewed. This commit finalizes the
implementation with minimal cleanup and comprehensive documentation.

Changes:
- Refactored GenericMetadataPopover to use clickOutside action
  - Removed manual document.addEventListener for click outside
  - Now uses standardized action with trigger exclusion logic
  - Cleaner code, consistent with other components

Documentation:
- Created task-5-dropdown-primitives-completion.md
- Documented existing infrastructure (clickOutside, BaseDropdown)
- Justified 15 remaining manual event listeners
- API documentation for clickOutside action and BaseDropdown

What Already Existed:
- clickOutside action (full TypeScript, proper cleanup)
- BaseDropdown component (Svelte 5 snippets)
- Dropdown primitives (DropdownMenuContainer, DropdownItem, DropdownMenu)
- ~10 components already using clickOutside
- Specialized dropdowns (StatusDropdown, PostDropdown, etc.)

Justified Exceptions (manual listeners kept):
- DropdownMenu.svelte: Complex submenu logic with Floating UI
- ProjectListItem/PostListItem: Global dropdown coordination pattern
- BaseModal + forms: Keyboard shortcuts (Escape, Cmd+S)
- Various: Scroll/resize positioning (layout concerns)

Decision: Did NOT use Runed library
- Custom clickOutside implementation is production-ready
- No advantage from external dependency
- Current solution is type-safe and well-tested

Phase 3 (List Utilities & Primitives) now complete!
- Task 4: List filtering utilities 
- Task 5: Dropdown primitives 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 19:47:09 -07:00
50b297ae2a docs: mark Task 4 list filtering utilities as complete
Task 4 was already ~90% complete when we started Phase 3:
- createListFilters utility already exists and is fully functional
- Uses Svelte 5 runes ($state, $derived) for reactivity
- Generic type-safe configuration with FilterConfig<T>
- Integrated into projects and posts list pages
- Removed ~100 lines of duplicated filtering logic

Changes in this commit:
- Add comprehensive completion documentation (task-4-list-filters-completion.md)
- Update admin modernization plan with Task 4 completion status
- Add test script to package.json for future testing
- Document testing approach (integration-tested, not unit-tested)

Testing notes:
- Rune-based code cannot be unit tested outside Svelte compiler
- Extensively integration-tested through projects/posts pages
- Manual QA complete for all filtering and sorting scenarios

Implementation details documented:
- 8 common sort functions (dateDesc, dateAsc, stringAsc, etc.)
- Filter equality matching with 'all' bypass
- Reactive updates via $derived
- Type-safe API with ListFiltersResult<T>

Media page intentionally uses manual filtering due to server-side
pagination requirements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 01:06:38 -07:00
a0c8dda3d3 docs: update admin modernization plan with Phase 2 completion
Updates to reflect current progress:
- Added progress overview showing Phase 2 complete
- Marked Task 3 (Project Form) as complete with implementation details
- Marked Task 6 (Autosave Store) as complete with feature summary
- Updated rollout strategy with phase completion status
- Documented 42% reduction in ProjectForm size (720 → 417 lines)

Phase 2 achievements:
- Composable form stores with Svelte 5 runes
- Reusable draft recovery and navigation guards
- Generic autosave store for all forms
- Manual QA complete

Next up: Phase 3 (List utilities & primitives)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 00:40:30 -07:00
1339e81bf4 docs: mark Task 3 project form refactor as complete
Update task-3 plan document with:
- Completion status and commit reference
- Implementation results summary
- Checkboxes for completed phases
- Updated success criteria checklist

All implementation work is complete, manual QA testing pending.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 00:37:49 -07:00
34a3e370ec refactor(admin): modularize ProjectForm with composable stores
Extract reusable form patterns following Svelte 5 best practices:

**New Store Factory** (`project-form.svelte.ts`)
- Centralizes form state management with `$state` and `$derived` runes
- Provides validation, payload building, and field mutation methods
- Type-safe with ProjectFormData interface
- Reusable across different contexts

**New Helpers**
- `useDraftRecovery.svelte.ts`: Generic draft restoration with auto-detection
- `useFormGuards.svelte.ts`: Navigation guards, beforeunload warning, Cmd+S shortcut
- `DraftPrompt.svelte`: Extracted UI component for draft recovery prompts

**Refactored ProjectForm.svelte**
- Reduced from 720 lines to 417 lines (42% reduction)
- Uses new composable helpers instead of inline logic
- Cleaner separation between UI orchestration and business logic
- All form state now managed through formStore
- Draft recovery, navigation guards fully extracted

**Benefits**
- Reusable patterns for PostForm, EssayForm, etc.
- Easier to test helpers in isolation
- Consistent UX across all admin forms
- Better maintainability and code organization

Closes Task 3 of admin modernization plan (Phase 2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 23:24:50 -07:00
0c5e9c8d13 docs: add Task 3 project form refactor plan
Document the planned refactoring of ProjectForm.svelte to use:
- Store factory for form state management
- Reusable draft recovery helper
- Reusable form guards helper
- Simplified component structure

This will reduce ProjectForm from ~719 lines to ~200-300 lines and
establish patterns for PostForm, EssayForm, and other admin forms.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 22:41:11 -07:00