Added AWQ Articles
This commit is contained in:
14
src/keystatic/collections/awq/article.ts
Normal file
14
src/keystatic/collections/awq/article.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { collection } from '@keystatic/core';
|
||||
|
||||
import { createArticleField } from '@/keystatic/fields/article';
|
||||
|
||||
export default collection({
|
||||
label: 'AWQ - Posts',
|
||||
slugField: 'title',
|
||||
path: 'content/awq/articles/*',
|
||||
format: { contentField: 'content' },
|
||||
entryLayout: 'content',
|
||||
schema: {
|
||||
...createArticleField('awq/articles', 'awq'),
|
||||
},
|
||||
});
|
||||
7
src/keystatic/collections/awq/index.ts
Normal file
7
src/keystatic/collections/awq/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import posts from '@/keystatic/collections/awq/article';
|
||||
|
||||
const awqCollections = {
|
||||
awq_posts: posts,
|
||||
};
|
||||
|
||||
export default awqCollections;
|
||||
@@ -1,12 +1,17 @@
|
||||
import { fields } from '@keystatic/core';
|
||||
|
||||
import { createContentField } from '@/keystatic/fields/content';
|
||||
import { createPathField } from '@/keystatic/fields/general';
|
||||
import { createSEOField } from '@/keystatic/fields/seo';
|
||||
import { createMetaField } from '@/keystatic/fields/meta';
|
||||
|
||||
export const createArticleField = (imageSubfolder: string) => ({
|
||||
export const createArticleField = (
|
||||
imageSubfolder: string,
|
||||
defaultPath: string = ''
|
||||
) => ({
|
||||
title: fields.slug({ name: { label: 'Title' } }),
|
||||
summary: fields.text({ label: 'Summary', multiline: true }),
|
||||
path: createPathField(defaultPath),
|
||||
cover: fields.object({
|
||||
src: fields.image({
|
||||
label: 'Cover Image',
|
||||
|
||||
304
src/keystatic/fields/awq/general.ts
Normal file
304
src/keystatic/fields/awq/general.ts
Normal file
@@ -0,0 +1,304 @@
|
||||
import { type ComponentSchema, fields } from '@keystatic/core';
|
||||
import { createOperatorField } from '@/keystatic/fields/general';
|
||||
|
||||
export const createCharacteristicReferenceField = (): ComponentSchema =>
|
||||
fields.select({
|
||||
label: 'Characteristic',
|
||||
options: [
|
||||
{ label: 'Weapon Skill', value: 'ws' },
|
||||
{ label: 'Ballistic Skill', value: 'bs' },
|
||||
{ label: 'Strength', value: 's' },
|
||||
{ label: 'Toughness', value: 't' },
|
||||
{ label: 'Initiative', value: 'i' },
|
||||
{ label: 'Dexterity', value: 'dex' },
|
||||
{ label: 'Agility', value: 'ag' },
|
||||
{ label: 'Intelligence', value: 'int' },
|
||||
{ label: 'Willpower', value: 'wp' },
|
||||
{ label: 'Fellowship', value: 'fel' },
|
||||
],
|
||||
defaultValue: 'ws',
|
||||
});
|
||||
|
||||
export const createSkillReferenceField = (): ComponentSchema =>
|
||||
fields.select({
|
||||
label: 'Skill',
|
||||
options: [
|
||||
{
|
||||
label: 'Melee',
|
||||
value: 'melee',
|
||||
},
|
||||
{
|
||||
label: 'Defence',
|
||||
value: 'defence',
|
||||
},
|
||||
{
|
||||
label: 'Shooting',
|
||||
value: 'shooting',
|
||||
},
|
||||
{
|
||||
label: 'Throwing',
|
||||
value: 'throwing',
|
||||
},
|
||||
{
|
||||
label: 'Brawn',
|
||||
value: 'brawn',
|
||||
},
|
||||
{
|
||||
label: 'Toil',
|
||||
value: 'toil',
|
||||
},
|
||||
{
|
||||
label: 'Consume Alcohol',
|
||||
value: 'consume-alcohol',
|
||||
},
|
||||
{
|
||||
label: 'Endurance',
|
||||
value: 'endurance',
|
||||
},
|
||||
{
|
||||
label: 'Perception',
|
||||
value: 'perception',
|
||||
},
|
||||
{
|
||||
label: 'Dodge',
|
||||
value: 'dodge',
|
||||
},
|
||||
{
|
||||
label: 'Skullduggery',
|
||||
value: 'skullduggery',
|
||||
},
|
||||
{
|
||||
label: 'Tradecraft',
|
||||
value: 'tradecraft',
|
||||
},
|
||||
{
|
||||
label: 'Stealth',
|
||||
value: 'stealth',
|
||||
},
|
||||
{
|
||||
label: 'Athletics',
|
||||
value: 'athletics',
|
||||
},
|
||||
{
|
||||
label: 'Intuition',
|
||||
value: 'intuition',
|
||||
},
|
||||
{
|
||||
label: 'Education',
|
||||
value: 'education',
|
||||
},
|
||||
{
|
||||
label: 'Discipline',
|
||||
value: 'discipline',
|
||||
},
|
||||
{
|
||||
label: 'Animal Handling',
|
||||
value: 'animal-handling',
|
||||
},
|
||||
{
|
||||
label: 'Leadership',
|
||||
value: 'leadership',
|
||||
},
|
||||
{
|
||||
label: 'Charm',
|
||||
value: 'charm',
|
||||
},
|
||||
],
|
||||
defaultValue: 'melee',
|
||||
});
|
||||
|
||||
export const createSizeReferenceField = (): ComponentSchema =>
|
||||
fields.select({
|
||||
label: 'Size',
|
||||
options: [
|
||||
{
|
||||
label: 'Tiny',
|
||||
value: 'tiny',
|
||||
},
|
||||
{
|
||||
label: 'Little',
|
||||
value: 'little',
|
||||
},
|
||||
{
|
||||
label: 'Small',
|
||||
value: 'small',
|
||||
},
|
||||
{
|
||||
label: 'Average',
|
||||
value: 'average',
|
||||
},
|
||||
{
|
||||
label: 'Large',
|
||||
value: 'large',
|
||||
},
|
||||
{
|
||||
label: 'Enormous',
|
||||
value: 'enormous',
|
||||
},
|
||||
{
|
||||
label: 'Monstrous',
|
||||
value: 'monstrous',
|
||||
},
|
||||
],
|
||||
defaultValue: 'average',
|
||||
});
|
||||
|
||||
export const createPsychologyReferenceField = (): ComponentSchema =>
|
||||
fields.object({
|
||||
type: fields.select({
|
||||
label: 'Psychology Type',
|
||||
defaultValue: 'animosity',
|
||||
options: [
|
||||
{ label: 'Animosity', value: 'animosity' },
|
||||
{ label: 'Fear', value: 'fear' },
|
||||
{ label: 'Frenzy', value: 'frenzy' },
|
||||
{ label: 'Hatred', value: 'hatred' },
|
||||
{ label: 'Prejudice', value: 'prejudice' },
|
||||
{ label: 'Terror', value: 'terror' },
|
||||
],
|
||||
}),
|
||||
target: fields.text({
|
||||
label: 'Target',
|
||||
description: 'e.g. Elves, Undead, Chaos',
|
||||
}),
|
||||
rating: fields.number({
|
||||
label: 'Rating',
|
||||
description: 'Fear/Terror Only',
|
||||
}),
|
||||
});
|
||||
|
||||
export const createRequirementsField = () =>
|
||||
fields.blocks(
|
||||
{
|
||||
characteristic: {
|
||||
label: 'Characteristic',
|
||||
schema: fields.object({
|
||||
characteristic: createCharacteristicReferenceField(),
|
||||
operator: createOperatorField(),
|
||||
value: fields.number({ label: 'Value', defaultValue: 3 }),
|
||||
}),
|
||||
},
|
||||
skill: {
|
||||
label: 'Skill',
|
||||
schema: fields.object({
|
||||
skill: createSkillReferenceField(),
|
||||
operator: createOperatorField(),
|
||||
value: fields.number({ label: 'Value', defaultValue: 3 }),
|
||||
}),
|
||||
},
|
||||
status: {
|
||||
label: 'Status',
|
||||
schema: fields.multiselect({
|
||||
label: 'Status Tier',
|
||||
options: [
|
||||
{
|
||||
value: 'copper',
|
||||
label: 'Copper',
|
||||
},
|
||||
{
|
||||
value: 'silver',
|
||||
label: 'Silver',
|
||||
},
|
||||
{
|
||||
value: 'gold',
|
||||
label: 'gold',
|
||||
},
|
||||
],
|
||||
defaultValue: ['copper'],
|
||||
}),
|
||||
},
|
||||
talent: {
|
||||
label: 'Talent',
|
||||
schema: fields.relationship({
|
||||
label: 'Talent',
|
||||
collection: 'awq_talents',
|
||||
}),
|
||||
},
|
||||
lore: {
|
||||
label: 'Lore',
|
||||
schema: fields.relationship({
|
||||
label: 'Lore',
|
||||
collection: 'awq_lores',
|
||||
}),
|
||||
},
|
||||
},
|
||||
{ label: 'Requirements' }
|
||||
);
|
||||
|
||||
export const createTraitsField = (): ComponentSchema =>
|
||||
fields.array(
|
||||
fields.object({
|
||||
name: fields.text({
|
||||
label: 'Trait name',
|
||||
}),
|
||||
description: fields.text({
|
||||
label: 'Description',
|
||||
multiline: true,
|
||||
}),
|
||||
grants: fields.blocks(
|
||||
{
|
||||
talent: {
|
||||
label: 'Talent',
|
||||
schema: fields.relationship({
|
||||
label: 'Talent',
|
||||
collection: 'awq_talents',
|
||||
}),
|
||||
},
|
||||
talent_options: {
|
||||
label: 'Talent Options',
|
||||
schema: fields.object({
|
||||
choices: fields.number({
|
||||
label: 'Number to choose',
|
||||
defaultValue: 1,
|
||||
}),
|
||||
options: fields.array(
|
||||
fields.relationship({
|
||||
label: 'Talent Options',
|
||||
collection: 'awq_talents',
|
||||
})
|
||||
),
|
||||
}),
|
||||
},
|
||||
talent_random: {
|
||||
label: 'Random Talent',
|
||||
schema: fields.object({
|
||||
rolls: fields.number({
|
||||
label: 'Rolls',
|
||||
defaultValue: 1,
|
||||
}),
|
||||
table: fields.array(
|
||||
fields.object({
|
||||
roll: fields.object({
|
||||
min: fields.number({ label: 'Min' }),
|
||||
max: fields.number({ label: 'Max' }),
|
||||
}),
|
||||
talent: fields.relationship({
|
||||
label: 'Talent',
|
||||
collection: 'awq_talents',
|
||||
}),
|
||||
})
|
||||
),
|
||||
}),
|
||||
},
|
||||
psychology: {
|
||||
label: 'Psychology',
|
||||
schema: createPsychologyReferenceField(),
|
||||
},
|
||||
custom: {
|
||||
label: 'Custom Effect',
|
||||
schema: fields.text({
|
||||
label: 'Custom Effect',
|
||||
multiline: true,
|
||||
}),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Trait Grants',
|
||||
}
|
||||
),
|
||||
}),
|
||||
{
|
||||
label: 'Traits',
|
||||
itemLabel: (props) => props.fields.name.value || 'Unnamed Trait',
|
||||
}
|
||||
);
|
||||
21
src/keystatic/fields/general.ts
Normal file
21
src/keystatic/fields/general.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ComponentSchema, fields } from '@keystatic/core';
|
||||
|
||||
export const createOperatorField = (): ComponentSchema =>
|
||||
fields.select({
|
||||
label: 'Operator',
|
||||
options: [
|
||||
{ label: '>=', value: 'gte' },
|
||||
{ label: '>', value: 'gt' },
|
||||
{ label: '=', value: 'eq' },
|
||||
{ label: '<', value: 'lt' },
|
||||
{ label: '<=', value: 'lte' },
|
||||
],
|
||||
defaultValue: 'eq',
|
||||
});
|
||||
|
||||
export const createPathField = (defaultValue: string): ComponentSchema =>
|
||||
fields.text({
|
||||
label: 'Path',
|
||||
description: 'Path on the website',
|
||||
defaultValue: defaultValue,
|
||||
});
|
||||
@@ -39,6 +39,5 @@ export const createMetaField = (): ComponentSchema =>
|
||||
},
|
||||
{
|
||||
label: 'Meta Information',
|
||||
layout: [4, 4, 4, 12, 12, 12],
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user