Add more functinoality
This commit is contained in:
parent
58b885deae
commit
a8aaf67022
3 changed files with 123 additions and 12 deletions
|
|
@ -11,6 +11,12 @@ export const artistType = defineType({
|
|||
type: 'string',
|
||||
validation: (Rule) => Rule.required(),
|
||||
}),
|
||||
defineField({
|
||||
name: 'sortKey',
|
||||
title: 'Sorting Key',
|
||||
type: 'string',
|
||||
validation: (Rule) => Rule.required(),
|
||||
}),
|
||||
defineField({
|
||||
name: 'slug',
|
||||
title: 'Slug',
|
||||
|
|
@ -24,6 +30,24 @@ export const artistType = defineType({
|
|||
type: 'image',
|
||||
options: {hotspot: true},
|
||||
}),
|
||||
defineField({
|
||||
name: 'description',
|
||||
title: 'Description',
|
||||
type: 'array',
|
||||
of: [{type: 'block'}],
|
||||
}),
|
||||
],
|
||||
orderings: [
|
||||
{
|
||||
title: 'Name (A → Z)',
|
||||
name: 'sortKeyAsc',
|
||||
by: [{field: 'name', direction: 'asc'}],
|
||||
},
|
||||
{
|
||||
title: 'Sorting key (A → Z)',
|
||||
name: 'sortKeyAsc',
|
||||
by: [{field: 'sortKey', direction: 'asc'}],
|
||||
},
|
||||
],
|
||||
preview: {
|
||||
select: {title: 'name', media: 'image'},
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import {releaseType} from './releaseType'
|
||||
import {artistType} from './artistType'
|
||||
export const schemaTypes = [releaseType, artistType]
|
||||
import {releaseType} from './releaseType'
|
||||
export const schemaTypes = [artistType, releaseType]
|
||||
|
|
|
|||
|
|
@ -9,15 +9,17 @@ export const releaseType = defineType({
|
|||
{name: 'main', title: 'Main', default: true},
|
||||
{name: 'media', title: 'Media'},
|
||||
{name: 'text', title: 'Text'},
|
||||
{name: 'links', title: 'Links'},
|
||||
{name: 'links', title: 'Streaming Links'},
|
||||
{name: 'references', title: 'Artists / Composers'},
|
||||
],
|
||||
|
||||
fieldsets: [
|
||||
{name: 'albuminfo', title: 'Album'},
|
||||
{name: 'main', title: 'Release Information', options: {columns: 2}},
|
||||
{name: 'media', title: 'Media', options: {columns: 2}},
|
||||
{name: 'media', title: 'Media'},
|
||||
{name: 'text', title: 'Descriptions'},
|
||||
{name: 'links', title: 'Links', options: {columns: 2}},
|
||||
{name: 'links', title: 'Streaming Links', options: {columns: 2}},
|
||||
{name: 'references', title: 'Artists / Composers'},
|
||||
],
|
||||
|
||||
fields: [
|
||||
|
|
@ -29,6 +31,22 @@ export const releaseType = defineType({
|
|||
fieldset: 'albuminfo',
|
||||
}),
|
||||
defineField({name: 'albumArtist', type: 'string', group: 'main', fieldset: 'albuminfo'}),
|
||||
defineField({
|
||||
name: 'catalogNo',
|
||||
title: 'Catalog #',
|
||||
type: 'string',
|
||||
group: 'main',
|
||||
fieldset: 'main',
|
||||
}),
|
||||
defineField({
|
||||
name: 'slug',
|
||||
title: 'Slug',
|
||||
type: 'slug',
|
||||
options: {source: 'catalogNo', maxLength: 10},
|
||||
validation: (Rule) => Rule.required(),
|
||||
group: 'main',
|
||||
fieldset: 'main',
|
||||
}),
|
||||
defineField({
|
||||
name: 'label',
|
||||
title: 'Label',
|
||||
|
|
@ -42,13 +60,6 @@ export const releaseType = defineType({
|
|||
],
|
||||
},
|
||||
}),
|
||||
defineField({
|
||||
name: 'catalogNo',
|
||||
title: 'Catalog #',
|
||||
type: 'string',
|
||||
group: 'main',
|
||||
fieldset: 'main',
|
||||
}),
|
||||
defineField({name: 'upc', title: 'UPC/EAN', type: 'string', group: 'main', fieldset: 'main'}),
|
||||
defineField({
|
||||
name: 'releaseDate',
|
||||
|
|
@ -56,6 +67,7 @@ export const releaseType = defineType({
|
|||
type: 'date',
|
||||
group: 'main',
|
||||
fieldset: 'main',
|
||||
options: {hotspot: true},
|
||||
}),
|
||||
defineField({name: 'albumCover', type: 'image', group: 'media', fieldset: 'media'}),
|
||||
defineField({
|
||||
|
|
@ -66,6 +78,61 @@ export const releaseType = defineType({
|
|||
group: 'media',
|
||||
fieldset: 'media',
|
||||
}),
|
||||
defineField({
|
||||
name: 'tracks',
|
||||
title: 'Track previews',
|
||||
group: 'media',
|
||||
fieldset: 'media',
|
||||
type: 'array',
|
||||
of: [
|
||||
defineField({
|
||||
name: 'track',
|
||||
title: 'Track',
|
||||
type: 'object',
|
||||
fields: [
|
||||
defineField({
|
||||
name: 'title',
|
||||
title: 'Title',
|
||||
type: 'string',
|
||||
validation: (Rule) => Rule.required(),
|
||||
}),
|
||||
defineField({
|
||||
name: 'artistText',
|
||||
title: 'Artist / Composer',
|
||||
type: 'string',
|
||||
}),
|
||||
defineField({
|
||||
name: 'duration',
|
||||
title: 'Duration',
|
||||
type: 'string',
|
||||
}),
|
||||
defineField({
|
||||
name: 'previewMp3',
|
||||
title: '30s preview (MP3)',
|
||||
type: 'file',
|
||||
options: {accept: 'audio/mpeg'},
|
||||
}),
|
||||
],
|
||||
preview: {
|
||||
select: {
|
||||
title: 'title',
|
||||
trackNo: 'trackNo',
|
||||
artistText: 'artistText',
|
||||
duration: 'duration',
|
||||
},
|
||||
prepare({title, trackNo, artistText, duration}) {
|
||||
const subtitleParts = [artistText, duration && `⏱ ${duration}`].filter(Boolean)
|
||||
|
||||
return {
|
||||
title: `${trackNo ? `${trackNo}. ` : ''}${title || '(Untitled track)'}`,
|
||||
subtitle: subtitleParts.join(' · '),
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
|
||||
defineField({
|
||||
name: 'shortDescription',
|
||||
title: 'Short Description',
|
||||
|
|
@ -82,6 +149,13 @@ export const releaseType = defineType({
|
|||
group: 'text',
|
||||
fieldset: 'text',
|
||||
}),
|
||||
defineField({
|
||||
name: 'officialUrl',
|
||||
title: 'Official Link',
|
||||
type: 'url',
|
||||
group: 'links',
|
||||
fieldset: 'links',
|
||||
}),
|
||||
defineField({
|
||||
name: 'spotifyUrl',
|
||||
title: 'Spotify',
|
||||
|
|
@ -119,6 +193,19 @@ export const releaseType = defineType({
|
|||
group: 'links',
|
||||
fieldset: 'links',
|
||||
}),
|
||||
defineField({
|
||||
name: 'artists',
|
||||
title: 'Artists',
|
||||
group: 'references',
|
||||
fieldset: 'references',
|
||||
type: 'array',
|
||||
of: [
|
||||
{
|
||||
type: 'reference',
|
||||
to: [{type: 'artist'}],
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
|
||||
orderings: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue