From 400d7ab2a14c10dc0a54065ee60b44fad5600655 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 26 Aug 2026 10:43:44 +0000 Subject: [PATCH] refactor: use community lexicon defs in uses, talk and location records --- app/components/TheHome.server.vue | 2 +- app/components/TheUses.server.vue | 10 +- app/components/admin/LocationForm.vue | 53 ++- app/components/admin/ProjectForm.vue | 23 +- app/components/admin/TalkForm.vue | 66 +++- app/components/admin/UsesItemForm.vue | 111 ++++-- lexicons/README.md | 20 +- .../community/lexicon/location/address.json | 41 +++ lexicons/dev/roe/ama.json | 61 +++- lexicons/dev/roe/defs.json | 15 - lexicons/dev/roe/location.json | 30 +- lexicons/dev/roe/talk.json | 25 +- lexicons/dev/roe/usesItem.json | 32 +- package.json | 3 +- .../migrate-records-to-community-lexicons.ts | 338 ++++++++++++++++++ server/api/current-location.get.ts | 33 +- server/api/upcoming-conferences.get.ts | 2 + server/api/update-location.post.ts | 2 - server/routes/uses.md.get.ts | 4 +- server/utils/atproto.ts | 21 ++ server/utils/cms/location.ts | 56 ++- server/utils/cms/talks.ts | 37 +- server/utils/cms/uses.ts | 59 ++- shared/cms/blob.ts | 3 + shared/cms/talk-mapper.ts | 3 +- shared/cms/uses.ts | 4 +- shared/lex/community/lexicon.ts | 1 + .../defs.ts => community/lexicon/location.ts} | 2 +- .../lexicon/location/address.defs.ts | 82 +++++ .../lex/community/lexicon/location/address.ts | 6 + shared/lex/dev/roe.ts | 1 - shared/lex/dev/roe/ama.defs.ts | 8 +- shared/lex/dev/roe/defs.defs.ts | 32 -- shared/lex/dev/roe/location.defs.ts | 19 +- shared/lex/dev/roe/talk.defs.ts | 14 +- shared/lex/dev/roe/usesItem.defs.ts | 44 +-- 36 files changed, 946 insertions(+), 317 deletions(-) create mode 100644 lexicons/community/lexicon/location/address.json delete mode 100644 lexicons/dev/roe/defs.json create mode 100644 scripts/migrate-records-to-community-lexicons.ts rename shared/lex/{dev/roe/defs.ts => community/lexicon/location.ts} (57%) create mode 100644 shared/lex/community/lexicon/location/address.defs.ts create mode 100644 shared/lex/community/lexicon/location/address.ts delete mode 100644 shared/lex/dev/roe/defs.defs.ts diff --git a/app/components/TheHome.server.vue b/app/components/TheHome.server.vue index 91d54ce9..192f7450 100644 --- a/app/components/TheHome.server.vue +++ b/app/components/TheHome.server.vue @@ -221,7 +221,7 @@ const [{ data: currentLocation }, { data: upcomingConferences }, { data: streams :src="conference.image.url" width="320" height="128" - :alt="`Logo for ${conference.name}`" + :alt="conference.image.alt" class="w-full h-full object-cover object-center" /> diff --git a/app/components/TheUses.server.vue b/app/components/TheUses.server.vue index 86f64166..963cb244 100644 --- a/app/components/TheUses.server.vue +++ b/app/components/TheUses.server.vue @@ -27,7 +27,7 @@ > () const form = reactive({ - city: props.initial?.city ?? '', - region: props.initial?.region ?? '', - country: props.initial?.country ?? '', - countryCode: props.initial?.countryCode ?? '', + city: props.initial?.address?.locality ?? '', + region: props.initial?.address?.region ?? '', + countryCode: props.initial?.address?.country ?? '', meetupAvailable: props.initial?.meetupAvailable ?? true, }) @@ -28,10 +27,12 @@ async function onSubmit () { submitting.value = true try { const value: LocationValue = { - city: form.city, - ...(form.region ? { region: form.region } : {}), - country: form.country, - countryCode: form.countryCode.toUpperCase(), + address: { + $type: 'community.lexicon.location.address', + country: form.countryCode.toUpperCase(), + ...(form.region ? { region: form.region } : {}), + locality: form.city, + }, meetupAvailable: form.meetupAvailable, ...(props.initial?.createdAt ? { createdAt: props.initial.createdAt } : { createdAt: new Date().toISOString() }), } @@ -78,29 +79,19 @@ async function onSubmit () { -
- - -
+
- Screenshot +
-
-