Skip to content

Commit

Permalink
Update things
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdinandsalis committed Aug 29, 2024
1 parent 209accf commit 5fb0bef
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 116 deletions.
2 changes: 1 addition & 1 deletion app/routes/_index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function Home() {

return (
<div className="space-y-16 text-balance md:space-y-20 lg:space-y-24">
<div className="relative -mx-4 grid grid-cols-1 grid-rows-1 sm:-mx-8 sm:rounded-md md:-mx-12">
<div className="relative -mx-4 grid grid-cols-1 grid-rows-1 sm:-mx-8 sm:rounded-md md:-mx-12 md:shadow-md">
<h1 className="sr-only">Einleitung</h1>
<figure className="col-end relative col-start-1 row-start-1">
<picture>
Expand Down
2 changes: 2 additions & 0 deletions app/routes/aktuelles/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const YearSchema = z.object({
graduatedAt: z.coerce.date().nullable(),
mentor: PersonSchema.pick({ givenNames: true, familyName: true }).extend({
name: z.string(),
slug: z.object({ current: z.string() }),
}),
photos: z.array(PhotoSchema).nullable(),
plan: z.string().nullable(),
Expand Down Expand Up @@ -46,6 +47,7 @@ export const aktuellesQuery = defineQuery(`{
familyName,
givenNames,
"name": givenNames + " " + familyName,
slug
},
photos | order(takenAt desc)
}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/aktuelles/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function YearCard({ letter, startedAt, mentor, photos, plan }: Year) {
<div className="">
<Link
className="font-bold text-secondary hover:underline hover:underline-offset-2"
to={`/ueber-uns/#${mentor?.name}`}
to={`/ueber-uns/#${mentor?.slug.current}`}
>
{mentor?.name}
</Link>
Expand Down
10 changes: 5 additions & 5 deletions app/routes/aufnahme+/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ export default function Aufnahme() {
Beiträge Schuljahr {current?.start.getFullYear()}/
{current?.end.getFullYear().toString().slice(-2)}
</h2>
<div className="mb-8 max-w-prose text-base">
<dl className="grid grid-cols-1 gap-2 divide-y divide-muted">
{current?.costs.list.map((cost, idx) => {
const first = idx === 0
<div className="mb-8 text-base">
<dl className="grid grid-cols-1 gap-1">
{current?.costs.list.map(cost => {
//const first = idx === 0

return (
<div
className={cn('-mx-4 p-4', {
'rounded-md bg-card/90': first,
'bg-card/90': true,
})}
key={cost.title}
>
Expand Down
2 changes: 2 additions & 0 deletions app/routes/ueber-uns+/_index.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const ueberUnsQuery = defineQuery(`{
"persons": *[_type == "person"] | order(priority asc) | order(familyName asc) {
_id,
_type,
slug,
portrait,
givenNames,
familyName,
Expand All @@ -19,6 +20,7 @@ export const ueberUnsQuery = defineQuery(`{
}`)

export const PersonSchema = z.object({
slug: z.object({ current: z.string() }),
priority: z.number().optional(),
givenNames: z.string(),
familyName: z.string(),
Expand Down
15 changes: 8 additions & 7 deletions app/routes/ueber-uns+/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as ScrollArea from '@radix-ui/react-scroll-area'
import { unstable_defineLoader as defineLoader } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { Link, useLoaderData } from '@remix-run/react'
import { type SanityImageSource } from '@sanity/image-url/lib/types/types.js'
import { loadQuery } from '@sanity/react-loader'
import { ExternalLinkIcon, SmileIcon } from 'lucide-react'
import slug from 'slug'
import { BackToTop } from '#app/components/back-to-top.tsx'
import { Toc } from '#app/components/toc.tsx'
import { Divider } from '#app/components/ui/divider.tsx'
import { urlFor } from '#app/sanity/instance.ts'
Expand Down Expand Up @@ -349,14 +347,15 @@ function StaffCard({
name: string | null
portrait: SanityImageSource | null
description: string | null
slug: { current: string } | null
email: string | null
website: string | null
phone: string | null
}
}) {
return (
<figure
id={person.name ? slug(person?.name) : ''}
id={person.slug?.current}
key={person.name}
className="flex w-60 flex-none flex-col space-y-4 overflow-hidden rounded-md bg-card p-6 shadow-md"
>
Expand Down Expand Up @@ -389,9 +388,11 @@ function StaffCard({
</div>
<figcaption className="flex flex-1 flex-col">
<hgroup className="mb-2 flex-1">
<h1 className="mb-1 text-lg font-bold leading-tight text-primary">
{person.name}
</h1>
<Link to={`/ueber-uns#${person.slug?.current}`} className="block">
<h1 className="mb-1 text-lg font-bold leading-tight text-primary">
{person.name}
</h1>
</Link>
<h2 className="max-w-[18ch] font-condensed text-sm leading-tight text-muted-foreground">
{person.description}
</h2>
Expand Down
10 changes: 10 additions & 0 deletions app/sanity/schema/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ export default defineType({
},
],
}),
defineField({
name: 'slug',
type: 'slug',
title: 'Slug',
options: {
source: document => `${document.givenNames} ${document.familyName}`,
maxLength: 96,
},
validation: Rule => Rule.required(),
}),
defineField({
name: 'priority',
type: 'number',
Expand Down
205 changes: 103 additions & 102 deletions app/sanity/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,103 +391,6 @@ export type AllSanitySchemaTypes =
| MediaTag
| Slug
export declare const internalGroqTypeReferenceTo: unique symbol
// Source: ./app/routes/_index/query.ts
// Variable: query
// Query: { "hero": *[_type == "home-hero"][0]{ _id, _type, image, "caption": image->caption, "attribution": image->attribution }, "testimonials": *[_type == "testimonial"] | order(_createdAt desc) { _id, _type, name, quote, photo, year -> { graduatedAt, startedAt, letter } }[0...4], "posts": *[_type == "post"] | order(publishedAt desc) { _id, _type, title, previewText, slug, cover, publishedAt }[0...3]}
export type QueryResult = {
hero: {
_id: string
_type: 'home-hero'
image: {
asset?: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
hotspot?: SanityImageHotspot
crop?: SanityImageCrop
caption?: string
alt?: string
attribution?: string
_type: 'image'
} | null
caption: null
attribution: null
} | null
testimonials: Array<{
_id: string
_type: 'testimonial'
name: string | null
quote: string | null
photo: {
asset?: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
hotspot?: SanityImageHotspot
crop?: SanityImageCrop
attribution?: string
alt?: string
_type: 'image'
} | null
year: {
graduatedAt: string | null
startedAt: string | null
letter:
| 'alpha'
| 'beta'
| 'chi'
| 'delta'
| 'epsilon'
| 'eta'
| 'gamma'
| 'hho'
| 'iota'
| 'kappa'
| 'lambda'
| 'my'
| 'ny'
| 'omega'
| 'omikron'
| 'phi'
| 'pi'
| 'psi'
| 'sigma'
| 'tau'
| 'theta'
| 'xi'
| 'ypsilon'
| 'zeta'
| null
} | null
}>
posts: Array<{
_id: string
_type: 'post'
title: string | null
previewText: string | null
slug: Slug | null
cover: {
asset?: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
hotspot?: SanityImageHotspot
crop?: SanityImageCrop
caption?: string
alt?: string
attribution?: string
_type: 'image'
} | null
publishedAt: string | null
}>
}

// Source: ./app/routes/aktuelles_.beitraege+/$slug.query.ts
// Variable: beitraegeSlugQuery
// Query: *[_type == "post" && slug.current == $slug][0] { _id, _type, title, cover, body, slug, publishedAt }
Expand Down Expand Up @@ -597,20 +500,118 @@ export type BeitraegeIndexQueryResult = {
}>
}

// Source: ./app/routes/_index/query.ts
// Variable: query
// Query: { "hero": *[_type == "home-hero"][0]{ _id, _type, image, "caption": image->caption, "attribution": image->attribution }, "testimonials": *[_type == "testimonial"] | order(_createdAt desc) { _id, _type, name, quote, photo, year -> { graduatedAt, startedAt, letter } }[0...4], "posts": *[_type == "post"] | order(publishedAt desc) { _id, _type, title, previewText, slug, cover, publishedAt }[0...3]}
export type QueryResult = {
hero: {
_id: string
_type: 'home-hero'
image: {
asset?: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
hotspot?: SanityImageHotspot
crop?: SanityImageCrop
caption?: string
alt?: string
attribution?: string
_type: 'image'
} | null
caption: null
attribution: null
} | null
testimonials: Array<{
_id: string
_type: 'testimonial'
name: string | null
quote: string | null
photo: {
asset?: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
hotspot?: SanityImageHotspot
crop?: SanityImageCrop
attribution?: string
alt?: string
_type: 'image'
} | null
year: {
graduatedAt: string | null
startedAt: string | null
letter:
| 'alpha'
| 'beta'
| 'chi'
| 'delta'
| 'epsilon'
| 'eta'
| 'gamma'
| 'hho'
| 'iota'
| 'kappa'
| 'lambda'
| 'my'
| 'ny'
| 'omega'
| 'omikron'
| 'phi'
| 'pi'
| 'psi'
| 'sigma'
| 'tau'
| 'theta'
| 'xi'
| 'ypsilon'
| 'zeta'
| null
} | null
}>
posts: Array<{
_id: string
_type: 'post'
title: string | null
previewText: string | null
slug: Slug | null
cover: {
asset?: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
hotspot?: SanityImageHotspot
crop?: SanityImageCrop
caption?: string
alt?: string
attribution?: string
_type: 'image'
} | null
publishedAt: string | null
}>
}

// Source: ./app/routes/aufnahme+/ _index.query.ts
// Variable: aufnahmeQuery
// Query: { "currentSchoolYear": *[_type == "schoolYear" && end > now()] | order(start desc) { _id, _type, start, end, costs->{ definedAt, list } }[0]}
// Query: { "currentSchoolYear": *[_type == "schoolYear" && end > now()] | order(start asc) { _id, _type, start, end, costs->{ definedAt, list } }[0]}
export type AufnahmeQueryResult = {
currentSchoolYear: null
}

// Source: ./app/routes/ueber-uns+/_index.query.ts
// Variable: ueberUnsQuery
// Query: { "persons": *[_type == "person"] | order(priority asc) | order(familyName asc) { _id, _type, portrait, givenNames, familyName, "name": givenNames + " " + familyName, description, roles, email, phone, website, publishedAt }}
// Query: { "persons": *[_type == "person"] | order(priority asc) | order(familyName asc) { _id, _type, slug, portrait, givenNames, familyName, "name": givenNames + " " + familyName, description, roles, email, phone, website, publishedAt }}
export type UeberUnsQueryResult = {
persons: Array<{
_id: string
_type: 'person'
slug: null
portrait: {
asset?: {
_ref: string
Expand Down Expand Up @@ -641,10 +642,10 @@ export type UeberUnsQueryResult = {
import '@sanity/client'
declare module '@sanity/client' {
interface SanityQueries {
'{\n "hero": *[_type == "home-hero"][0]{\n _id,\n _type,\n image,\n "caption": image->caption,\n "attribution": image->attribution\n }, \n "testimonials": *[_type == "testimonial"] | order(_createdAt desc) {\n _id,\n _type,\n name,\n quote,\n photo,\n year -> {\n graduatedAt,\n startedAt,\n letter\n }\n }[0...4],\n "posts": *[_type == "post"] | order(publishedAt desc) {\n _id,\n _type,\n title,\n previewText,\n slug,\n cover,\n publishedAt\n }[0...3]\n}': QueryResult
'\n*[_type == "post" && slug.current == $slug][0] {\n _id,\n _type,\n title,\n cover,\n body,\n slug,\n publishedAt\n }\n': BeitraegeSlugQueryResult
'{\n "posts": *[_type == "post"] | order(publishedAt desc) {\n _id,\n _type,\n title,\n cover,\n previewText,\n slug,\n publishedAt\n },\n}': BeitraegeIndexQueryResult
'{\n "currentSchoolYear": *[_type == "schoolYear" && end > now()] | order(start desc) {\n _id,\n _type,\n start,\n end,\n costs->{\n definedAt,\n list\n }\n }[0]\n}': AufnahmeQueryResult
'{\n "persons": *[_type == "person"] | order(priority asc) | order(familyName asc) {\n _id,\n _type,\n portrait,\n givenNames,\n familyName,\n "name": givenNames + " " + familyName,\n description,\n roles,\n email,\n phone,\n website,\n publishedAt\n }\n}': UeberUnsQueryResult
'{\n "hero": *[_type == "home-hero"][0]{\n _id,\n _type,\n image,\n "caption": image->caption,\n "attribution": image->attribution\n }, \n "testimonials": *[_type == "testimonial"] | order(_createdAt desc) {\n _id,\n _type,\n name,\n quote,\n photo,\n year -> {\n graduatedAt,\n startedAt,\n letter\n }\n }[0...4],\n "posts": *[_type == "post"] | order(publishedAt desc) {\n _id,\n _type,\n title,\n previewText,\n slug,\n cover,\n publishedAt\n }[0...3]\n}': QueryResult
'{\n "currentSchoolYear": *[_type == "schoolYear" && end > now()] | order(start asc) {\n _id,\n _type,\n start,\n end,\n costs->{\n definedAt,\n list\n }\n }[0]\n}': AufnahmeQueryResult
'{\n "persons": *[_type == "person"] | order(priority asc) | order(familyName asc) {\n _id,\n _type,\n slug,\n portrait,\n givenNames,\n familyName,\n "name": givenNames + " " + familyName,\n description,\n roles,\n email,\n phone,\n website,\n publishedAt\n }\n}': UeberUnsQueryResult
}
}

0 comments on commit 5fb0bef

Please sign in to comment.