Skip to content

Commit 327bfad

Browse files
Add needs_checking display
1 parent df186ac commit 327bfad

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

functions/Cursor/getCursorAlpha.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ client:
1717
- path: 'examples/getCursorAlpha.lua'
1818
description: |
1919
This example prints the cursor alpha to chatbox using */cursoralpha* command:
20+
meta:
21+
- needs_checking: Hello, world

web/src/components/NoteBox.astro

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
import type { HTMLAttributes } from 'astro/types';
3+
import type { NotesTypeType } from '@src/utils/types';
34
45
interface Props extends HTMLAttributes<'div'> {
5-
type?: 'info' | 'warning' | 'important' | 'tip';
6+
type?: NotesTypeType;
67
}
78
89
const { type = 'info', class: className, ...rest } = Astro.props;
@@ -16,6 +17,7 @@ const { type = 'info', class: className, ...rest } = Astro.props;
1617
'note-warning': type === 'warning',
1718
'note-important': type === 'important',
1819
'note-tip': type === 'tip',
20+
'note-needs_checking': type === 'needs_checking',
1921
},
2022
className
2123
]}
@@ -61,6 +63,16 @@ const { type = 'info', class: className, ...rest } = Astro.props;
6163
</span>
6264
)}
6365

66+
{type === 'needs_checking' && (
67+
<span style="font-size: 1.2rem;"><strong>This article needs checking:</strong></span>
68+
<span class="note-icon" aria-label="Important">
69+
<svg width="28" height="28" viewBox="0 0 20 20" fill="none" aria-hidden="true">
70+
<circle cx="10" cy="10" r="10" fill="#008dd4"/>
71+
<text x="10" y="15" text-anchor="middle" font-size="14" fill="#fff" font-family="Arial" font-weight="bold">!</text>
72+
</svg>
73+
</span>
74+
)}
75+
6476
<slot />
6577
</div>
6678

@@ -78,7 +90,8 @@ const { type = 'info', class: className, ...rest } = Astro.props;
7890
.custom-note-box.note-info,
7991
.custom-note-box.note-warning,
8092
.custom-note-box.note-important,
81-
.custom-note-box.note-tip {
93+
.custom-note-box.note-tip,
94+
.custom-note-box.note-needs_checking {
8295
padding-left: 3.5rem;
8396
padding-right: 1.25rem;
8497
}
@@ -99,6 +112,10 @@ const { type = 'info', class: className, ...rest } = Astro.props;
99112
border-left-color: #4caf50;
100113
}
101114

115+
.custom-note-box.note-needs_checking {
116+
border-left-color: #008dd4;
117+
}
118+
102119
.note-icon {
103120
position: absolute;
104121
top: 50%;

web/src/pages/reference/[event].astro

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import CodeExamplesSection from '@src/components/CodeExamplesSection.astro';
1616
import ItemDescription from '@src/components/ItemDescription.astro';
1717
import EnhancedMarkdown from '@src/components/EnhancedMarkdown.astro';
1818
import PreviewImages from '@src/components/PreviewImages.astro';
19+
import ChangelogList from '@src/components/ChangelogList.astro';
1920
2021
export async function getStaticPaths() {
2122
const events = await getCollection('events');
@@ -58,6 +59,9 @@ if (Array.isArray(event.data.notes) && event.data.notes.length > 0) {
5859
notesContent = event.data.notes;
5960
}
6061
62+
const eventMeta = event.data.meta || {};
63+
const changelogEntries = eventMeta.find(m => m.changelog)?.changelog ?? [];
64+
const needsChecking = eventMeta.find(m => m.needs_checking)?.needs_checking ?? undefined;
6165
---
6266

6367
<div class={"show-type-badge-" + eventType}>
@@ -66,6 +70,14 @@ if (Array.isArray(event.data.notes) && event.data.notes.length > 0) {
6670
title: event.id,
6771
tableOfContents: false,
6872
}}>
73+
{needsChecking && (
74+
<div class="notes-section">
75+
<NoteBox type="needs_checking">
76+
<EnhancedMarkdown content={needsChecking}/>
77+
</NoteBox>
78+
</div>
79+
)}
80+
6981
<!-- Description -->
7082
<ItemDescription description={event.data.description} incomplete={event.data.incomplete} />
7183

@@ -114,6 +126,8 @@ if (Array.isArray(event.data.notes) && event.data.notes.length > 0) {
114126

115127
<CodeExamplesSection codeExamples={eventExamples}, examplesRequired={true} theItem={event} />
116128

129+
<ChangelogList entries={changelogEntries} />
130+
117131
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksForItem(event)} currentId={event.id} />
118132
</StarlightPage>
119133
</div>

web/src/pages/reference/[func].astro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ if (Array.isArray(funcInfo.notes) && funcInfo.notes.length > 0) {
7373
7474
const metaArray = func.data[funcInfo.type]?.meta ?? [];
7575
const changelogEntries = metaArray.find(m => m.changelog)?.changelog ?? [];
76+
const needsChecking = metaArray.find(m => m.needs_checking)?.needs_checking ?? undefined;
7677
7778
let funcSyntaxes = parseFunctionSyntaxes(func.id, func.data);
7879
---
@@ -83,6 +84,14 @@ let funcSyntaxes = parseFunctionSyntaxes(func.id, func.data);
8384
title: func.id,
8485
tableOfContents: false,
8586
}}>
87+
{needsChecking && (
88+
<div class="notes-section">
89+
<NoteBox type="needs_checking">
90+
<EnhancedMarkdown content={needsChecking}/>
91+
</NoteBox>
92+
</div>
93+
)}
94+
8695
<!-- Pair Function Ref -->
8796
{funcPair && (
8897
<p><strong>Pair:</strong> <a href={`/reference/${funcPair}`}>{ funcPair }</a></p>

web/src/utils/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export type FunctionType = 'shared' | 'client' | 'server';
2+
export type NotesTypeType = 'info' | 'warning' | 'important' | 'tip' | 'needs_checking';
23
export type NotesType = {
3-
type: 'info' | 'warning' | 'important';
4+
type: NotesTypeType
45
content: string;
56
}[];

0 commit comments

Comments
 (0)