Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update tags for packages.json #560

Merged
merged 11 commits into from
Dec 30, 2023
28 changes: 10 additions & 18 deletions src/lib/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,46 @@ import { packageNameRegex } from 'package-name-regex';

const PACKAGES_TAGS = /** @type {const} */ ([
'animations',
'async-data',
'async-loading',
'audio-and-video',
'auth',
'bundler-plugins',
'charts',
'cli-tools',
'components-and-libraries',
'css-and-layout',
'data-fetching',
'data-visualisation',
'debugging',
'date-and-time',
'design-pattern',
'design-system',
'developer-experience',
'development-and-documentation',
'display-components',
'fonts-and-icons',
'forms-and-validation',
'graphql',
'documentation',
'forms-and-input',
'headless',
'icons-and-fonts',
'images',
'in-page-navigation',
'inputs-and-widgets',
'integrations',
'interactions',
'internationalization',
'intersection-observer',
'jsx',
'layout-and-structure',
'linting-and-formatting',
'maps',
'markdown',
'modals',
'multimedia',
'native',
'network-events',
'notifications',
'offline-and-online-detection',
'official',
'preprocessors',
'routers',
'seo',
'ssr',
'stores-and-state',
'sveltekit-adapters',
'testing',
'third-party-services',
'time-and-date',
'typescript',
'ui-components',
'user-interaction',
'viewport'
'validation'
]);

export const packagesSchema = z.array(
Expand Down
29 changes: 5 additions & 24 deletions src/routes/help/submitting/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@

const data = {
package: {
tags: extractUnique(packages, 'tags'),
categories: [...extractUnique(packages, 'category').filter((cat) => cat.label !== '')]
tags: extractUnique(packages, 'tags')
},
template: {
tags: extractUnique(templates, 'tags'),
categories: extractUnique(templates, 'category')
tags: extractUnique(templates, 'tags')
}
};

Expand All @@ -35,7 +33,6 @@
let url = 'https://svelte-lorem-ipsum.dev';
let description = 'A dummy text generator that does not exist';
let npm = 'svelte-lorem-ipsum';
let category;
let tags;
let repository = 'https://github.com/sveltejs/svelte-lorem-ipsum';

Expand All @@ -46,21 +43,18 @@
repository: repository ? repository : undefined,
description,
npm: npm ? npm : undefined,
category: category?.value,
tags: tags?.map((tag) => tag.value)
};

$: currentTags = data[type.value].tags;
$: currentCategories = data[type.value].categories;

onMount(() => {
const typeQuery = new URLSearchParams(location.search).get('type');
type = types.find((t) => t.value == typeQuery) || types[0];
});

async function clearCategoryAndTags() {
async function clearTags() {
await tick();
category = null;
tags = null;
}
</script>
Expand All @@ -86,7 +80,7 @@
isClearable={false}
showIndicator
bind:value={type}
on:select={clearCategoryAndTags}
on:select={clearTags}
/>
<span class="input-helper">The type of snippet to generate</span>
</div>
Expand Down Expand Up @@ -128,23 +122,10 @@
<span class="input-helper">The npm name of the package</span>
</div>
</div>
<div class="input-wrapper">
<label for="category">Category:</label>
<div>
<SvelteSelect
id="category"
items={currentCategories}
isClearable={false}
showIndicator
bind:value={category}
/>
<span class="input-helper">The category of the package</span>
</div>
</div>
<div class="input-wrapper">
<label for="tags" class="required">Tags:</label>
<div>
<SvelteSelect id="category" items={currentTags} showIndicator isMulti bind:value={tags} />
<SvelteSelect id="tags" items={currentTags} showIndicator isMulti bind:value={tags} />
<span class="input-helper">A list of tags</span>
</div>
</div>
Expand Down
Loading