display user kinds verbatim
This commit is contained in:
parent
2101ab50d2
commit
74feb38300
5 changed files with 28 additions and 50 deletions
|
|
@ -39,28 +39,6 @@ function formatDate(value: string): string {
|
|||
timeZone: 'UTC',
|
||||
}).format(new Date(`${value}T00:00:00Z`))
|
||||
}
|
||||
|
||||
function humanizeKind(kind: string): string {
|
||||
const words = kind.replaceAll(/[_-]+/g, ' ')
|
||||
|
||||
return words.charAt(0).toUpperCase() + words.slice(1)
|
||||
}
|
||||
|
||||
function pluralKind(kind: string, count: number): string {
|
||||
if (count === 1) {
|
||||
return kind
|
||||
}
|
||||
|
||||
if (kind.endsWith('y')) {
|
||||
return `${kind.slice(0, -1)}ies`
|
||||
}
|
||||
|
||||
if (kind.endsWith('s')) {
|
||||
return kind
|
||||
}
|
||||
|
||||
return `${kind}s`
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -87,11 +65,14 @@ function pluralKind(kind: string, count: number): string {
|
|||
|
||||
<template v-else-if="activeSchedule !== null">
|
||||
<header class="schedule-introduction">
|
||||
<p class="eyebrow">{{ humanizeKind(activeSchedule.elementKind) }} plan</p>
|
||||
<p class="eyebrow">
|
||||
<span class="schedule-kind">{{ activeSchedule.elementKind }}</span> plan
|
||||
</p>
|
||||
<h1>{{ activeSchedule.set.name }} schedule</h1>
|
||||
<p class="schedule-summary">
|
||||
{{ activeSchedule.assignmentCount }}
|
||||
{{ pluralKind(activeSchedule.elementKind, activeSchedule.assignmentCount) }} across
|
||||
{{ activeSchedule.elementKind }}
|
||||
{{ activeSchedule.assignmentCount === 1 ? 'assignment' : 'assignments' }} across
|
||||
{{ activeSchedule.days.length }}
|
||||
{{ activeSchedule.days.length === 1 ? 'day' : 'days' }}
|
||||
</p>
|
||||
|
|
@ -119,7 +100,7 @@ function pluralKind(kind: string, count: number): string {
|
|||
<ul v-else class="assignment-list">
|
||||
<li v-for="assignment in day.assignments" :key="assignment.id">
|
||||
<span class="assignment-path">{{ assignment.element.path.join(' / ') }}</span>
|
||||
<span class="assignment-kind">{{ humanizeKind(assignment.element.kind) }}</span>
|
||||
<span class="assignment-kind">{{ assignment.element.kind }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
@ -173,6 +154,10 @@ function pluralKind(kind: string, count: number): string {
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.schedule-kind {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-family: Georgia, 'Times New Roman', serif;
|
||||
|
|
@ -265,7 +250,7 @@ h1 {
|
|||
font-size: 0.62rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.page-state {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue