feat: add useBoardPosts + useBoardChannels composables, remove useBoard

- useBoardPosts: CRUD with useState('board.posts','board.loading')
- useBoardChannels: fetch + resolveTagChannel + slackUrl helpers
- useBoard.js removed (old suggestions wrapper); only app/pages/board.vue still imports it, will be rewritten in Phase 5
This commit is contained in:
Jennie Robinson Faber 2026-04-14 17:02:07 +01:00
parent 1fc937a26a
commit 78db4be7ba
3 changed files with 87 additions and 6 deletions

View file

@ -0,0 +1,33 @@
/**
* Board Channels Composable
* Shared state + helpers for mapping board tags to Slack channels.
*/
export function useBoardChannels() {
const channels = useState('board.channels', () => [])
async function fetchChannels() {
const result = await $fetch('/api/board/channels')
channels.value = result || []
return channels.value
}
function resolveTagChannel(tagSlugs = []) {
if (!tagSlugs?.length) return null
return (
channels.value.find((channel) =>
(channel.tagSlugs || []).some((slug) => tagSlugs.includes(slug))
) || null
)
}
function slackUrl(channelId) {
return `https://gammaspace.slack.com/archives/${channelId}`
}
return {
channels: readonly(channels),
fetchChannels,
resolveTagChannel,
slackUrl,
}
}