Skip to content

Commit 5ee7d94

Browse files
Add Incomplete_Pages
1 parent 348f728 commit 5ee7d94

File tree

3 files changed

+90
-3
lines changed

3 files changed

+90
-3
lines changed

web/astro.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ export default defineConfig({
3737
disable404Route: true,
3838
sidebar: [
3939
{
40-
label: 'Start here',
40+
label: 'Welcome',
4141
items: [
4242
{
4343
label: 'Introduction', link: '/',
4444
},
4545
{
4646
label: 'How you can help', link: '/articles/How_you_can_help',
4747
},
48+
{
49+
label: 'Incomplete Pages', link: '/Incomplete_Pages',
50+
},
4851
]
4952
},
5053
{

web/src/pages/Incomplete_Pages.astro

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getUnfinishedPages } from '@src/utils/general';
4+
5+
const unfinishedFunctions = getUnfinishedPages('functions');
6+
const unfinishedEvents = getUnfinishedPages('events');
7+
---
8+
9+
<StarlightPage frontmatter={{
10+
template: 'doc',
11+
title: 'Incomplete Pages',
12+
tableOfContents: false,
13+
}}>
14+
15+
<p>The following pages are not finished, and need your attention! Please help complete the MTA Wiki.</p>
16+
<p><a href="https://github.com/multitheftauto/wiki.multitheftauto.com/blob/main/CONTRIBUTING.md"
17+
class="guidelines-link">Contribution guidelines</a></p>
18+
19+
<h3>Unfinished Function Pages</h3>
20+
<p>These functions (part of the MTA Lua API) are <strong>missing documentation or code examples</strong>:</p>
21+
<section>
22+
<details>
23+
<summary>Total: {unfinishedFunctions.length}</summary>
24+
<ul>
25+
{unfinishedFunctions.map((func) => (
26+
<li>
27+
<a href={`/reference/${func}`}>{func}</a>
28+
</li>
29+
))}
30+
</ul>
31+
</details>
32+
</section>
33+
34+
<h3>Unfinished Event Pages</h3>
35+
<p>These events (part of the MTA Lua API) are <strong>missing documentation or code examples</strong>:</p>
36+
<section>
37+
<details>
38+
<summary>Total: {unfinishedEvents.length}</summary>
39+
<ul>
40+
{unfinishedEvents.map((event) => (
41+
<li>
42+
<a href={`/reference/${event}`}>{event}</a>
43+
</li>
44+
))}
45+
</ul>
46+
</details>
47+
</section>
48+
49+
</StarlightPage>
50+
51+
<style>
52+
.guidelines-link {
53+
font-size: 1.5rem;
54+
color: var(--sl-color-orange);
55+
font-weight: bold;
56+
}
57+
</style>

web/src/utils/general.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { marked } from 'marked';
22
import path from 'path';
3-
import { getFunctionsByTypeByCategory } from '@src/utils/functions';
4-
import { getEventsByTypeByCategory } from '@src/utils/events';
3+
import { getFunctionsByCategory, getFunctionsByTypeByCategory } from '@src/utils/functions';
4+
import { getEventsByCategory, getEventsByTypeByCategory } from '@src/utils/events';
55
import { getElementsByCategory, getElementCategory } from '@src/utils/elements';
66

77
import type { ImageMetadata } from 'astro';
@@ -199,3 +199,30 @@ export function getSeeAlsoLinksForItem(theItem: any): SeeAlsoLinkGroup[] {
199199
const allSeeAlso = [...new Set([...seeAlso, ...addToSeeAlso])];
200200
return getSeeAlsoLinksFromList(allSeeAlso);
201201
}
202+
203+
export function getUnfinishedPages(pageType: 'functions' | 'events'): string[] {
204+
const unfinishedPages: string[] = [];
205+
const pagesByCategory = {
206+
functions: getFunctionsByCategory(),
207+
events: getEventsByCategory(),
208+
};
209+
for (const category in pagesByCategory[pageType]) {
210+
const items = pagesByCategory[pageType][category];
211+
for (const item of items) {
212+
const data = item.data.shared || item.data.client || item.data.server || item.data;
213+
// Check if item description contains 'NEEDS DOCUMENTATION'
214+
if (data && data.description && data.description.includes('NEEDS DOCUMENTATION')) {
215+
unfinishedPages.push(item.id);
216+
} else {
217+
// Check if the item has no code examples
218+
const examples = item.data.shared?.examples || item.data.client?.examples || item.data.server?.examples || item.data.examples;
219+
if (!examples || examples.length === 0) {
220+
unfinishedPages.push(item.id);
221+
}
222+
}
223+
}
224+
}
225+
// Sort alphabetically
226+
unfinishedPages.sort((a, b) => a.localeCompare(b));
227+
return unfinishedPages;
228+
}

0 commit comments

Comments
 (0)