Context
The stx components in resources/components/ use an older syntax (Alpine-style directives, $props.x access, derived(), no <template> wrapper). Trailbuddy's components use the current convention (defineProps<T>() + withDefaults, <template> wrapper, PascalCase component imports).
ts-analytics is meant to be a reference implementation of an analytics dashboard built in the Stacks/STX stack — its component code should reflect the current best practice, not legacy syntax.
Reference
- New convention: https://github.com/stacksjs/trailbuddy/tree/main/resources/components
- e.g.
FeaturedTrailCard.stx,Hero.stx
- e.g.
- Outdated example in this repo:
resources/components/StatCard.stx
Scope
Migrate every file under resources/components/*.stx:
- EventLog.stx
- EventBar.stx
- FlowLink.stx
- InsightCard.stx
- SiteCard.stx
- StatCard.stx
- SessionModal.stx
- SessionCard.stx
- ErrorCard.stx
- (any others)
For each:
<script client>→<script server>(or whichever fits — match trailbuddy's choice)$props.x→ typeddefineProps<T>()+withDefaultsderived(() => ...)→ idiomatic equivalent in the new syntax@if/@class/x-iddirectives →<template>wrapper + standard binding syntax- PascalCase component references where applicable
Verification
bun run buildsucceeds- Dashboard renders with no visual regressions
- No console warnings about deprecated syntax