Skip to content

Commit 288c760

Browse files
committed
chore: show release id
1 parent 31512fb commit 288c760

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

packages/ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"singleQuote": true
4747
},
4848
"dependencies": {
49+
"@sanity/client": "^6.27.1",
4950
"date-fns": "4.1.0",
5051
"@vercel/stega": "0.1.2",
5152
"bulma": "0.9.4",

packages/ui/src/react/components.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2+
import { getVersionFromId } from '@sanity/client/csm'
23
import { vercelStegaSplit } from '@vercel/stega'
34
import groq from 'groq'
45
import { q } from 'groqd'
@@ -189,10 +190,15 @@ const { query: tableQuery, schema: tableSchema } = q('*')
189190
.filter("_type == 'page'")
190191
.grab({
191192
_id: q.string(),
193+
_originalId: q.string().optional(),
192194
_createdAt: q.string().optional(),
193195
_updatedAt: q.string().optional(),
194196
title: q.string().optional(),
195197
status: q.select({
198+
'_originalId in path("versions.**")': [
199+
'"in release"',
200+
q.literal('in release'),
201+
],
196202
'_originalId in path("drafts.**")': ['"draft"', q.literal('draft')],
197203
default: ['"published"', q.literal('published')],
198204
}),
@@ -227,12 +233,17 @@ export function _Table(props: TableProps) {
227233
const { cleaned, encoded } = vercelStegaSplit(type._updatedAt!)
228234
const date = new Date(cleaned)
229235
return (
230-
<tr key={type._id} data-created-at={type._createdAt}>
236+
<tr
237+
key={type._id}
238+
data-created-at={type._createdAt}
239+
data-original-id={type._originalId}
240+
data-id={type._id}
241+
>
242+
<td width={300}>{type.title}</td>
231243
<td style={{ whiteSpace: 'nowrap' }} width={300}>
232-
{type.title}
233-
</td>
234-
<td style={{ whiteSpace: 'nowrap' }} width={300}>
235-
{type.status}
244+
{type.status === 'in release' && type._originalId
245+
? getVersionFromId(type._originalId)
246+
: type.status}
236247
</td>
237248
<td style={{ whiteSpace: 'nowrap' }} width={300}>
238249
<time dateTime={type._updatedAt}>

pnpm-lock.yaml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)