Skip to content

Commit

Permalink
Correct frontend errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hunter-richardson committed Jun 17, 2024
1 parent da4033f commit 80ca564
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 28 deletions.
96 changes: 70 additions & 26 deletions src/facies/inflectere.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
defineProps<{ id: Hoc; }>();
const verba = defineModel<Hoc[]>('verba');
const categoria: string = eventus.value?.categoria ?? '';
const agendum: Faciendum<Hoc> = eventus.value?.referendum as Faciendum<Hoc>;
const tabula: Tabula<Hoc> | null = agendum?.putetur();
const verba: Hoc[] = [];
const tabula: Tabula<Hoc> | null = agendum?.putetur() ?? null;
const seligenda: string[] = []
const selecta: string[] = [];
Expand Down Expand Up @@ -40,6 +41,8 @@
import Spectere from './specere.vue';
import { genera, gradi, anglicum } from '../miscella/enumerationes';
import Cocutor from '../miscella/cocutor';
import { ref } from 'vue';
import { NumeramenAgendum } from '../praebeunda/agenda';
const eventus = defineModel<Eventus>('eventus');
const verbum = defineModel<Verbum>('verbum');
Expand Down Expand Up @@ -77,22 +80,28 @@
},
methods: {
async omnes (): Promise<Hoc[] | null> {
return await tabula?.tabulentur() ?? null;
async omnes (): Promise<Hoc[]> {
return await tabula?.tabulentur() ?? [];
},
async cole (): Promise<void> {
this.onerans = true;
this.verba = ((await this.omnes()) as Hoc[])
.filter(verbum =>
const omnia: Hoc[] = await this.omnes();
if (omnia) {
this.verba = omnia.filter(verbum =>
(this.selecta as string[]).every(selectum =>
verbum.valores().includes(selectum)));
await new Promise(() => this.onerans = false);
}
return await new Promise(() => this.onerans = !!omnia);
},
async numeramen (numeramen: Numeramen): Promise<void> {
if (this.figura === 'numeramenAgendum') {
const referendum: Referendum = (this.agendum as Agenda.NumeramenAgendum).referatur(numeramen.numerium);
async numeramen (numeramen: Hoc): Promise<void> {
if (this.figura === 'numeramenAgendum' &&
numeramen instanceof Numeramen &&
agendum instanceof Agenda.NumeramenAgendum) {
const referendum: Referendum = (agendum as Agenda.NumeramenAgendum).referatur(numeramen.numerium);
if (referendum instanceof Numerus) {
this.verbum = referendum as Numerus;
} else if (referendum instanceof Agenda.NomenAgendum) {
Expand All @@ -114,17 +123,53 @@
}
},
selige (verbum: Verbum): void {
selige (verbum: Hoc): void {
this.verbum = verbum;
},
refer (eventus: {
referendum?: Referendum;
categoria: string;
categoria: string,
referendum?: string,
gradus?: string,
genus?: string;
}): void {
if (eventus.referendum) {
let referendum: Referendum | null = null;
switch (figura) {
case 'actusAgendus':
if (agendum instanceof Agenda.ActusAgendus) {
switch (eventus.referendum) {
case 'nomen':
referendum = (agendum as Agenda.ActusAgendus).nomen();
break;
case 'actor':
referendum = (agendum as Agenda.ActusAgendus).actor(eventus.genus ?? '');
break;
}
}
break;
case 'nomenFactum':
if (agendum instanceof Agenda.NomenFactum) {
referendum = (agendum as Agenda.NomenFactum).actus();
}
break;
case 'adiectivumAgendum':
if (agendum instanceof Agenda.AdiectivumAgendum) {
referendum = (agendum as Agenda.AdiectivumAgendum).probetur({
gradus: eventus.gradus ?? '',
genus: eventus.genus ?? ''
});
}
break;
case 'incomparabile':
if (agendum instanceof Agenda.Incomparabile) {
referendum = (agendum as Agenda.Incomparabile).probetur(eventus.genus ?? '');
}
break;
}
if (referendum) {
this.eventus = {
referendum: eventus.referendum,
referendum: referendum,
categoria: eventus.categoria
};
};
Expand All @@ -133,6 +178,7 @@
async mounted (): Promise<void> {
this.verba = await this.omnes();
this.seligenda = [
...new Set((this.verba as Hoc[])
.map(verbum => verbum.valores())
Expand All @@ -158,16 +204,16 @@
<template v-if="figura === 'actusAgendus'">
<v-btn-toggle>
<v-btn append-icon='subject' :text="lingua === 'anglica' ? 'Noun' : 'Nomen'"
@click="refer({ categoria: 'nomen', referendum: (agendum as Agenda.ActusAgendus).nomen() ?? undefined });" />
@click="refer({ categoria: 'nomen', referendum: 'nomen' });" />
<v-btn append-icon='person' :text="lingua === 'anglica' ? 'Agent (masculine)' : 'Actor'"
@click="refer({ categoria: 'nomen', referendum: (agendum as Agenda.ActusAgendus).actor('masculinum') ?? undefined });" />
@click="refer({ categoria: 'nomen', referendum: 'actor', genus: 'masculinum' });" />
<v-btn append-icon='person' :text="lingua === 'anglica' ? 'Agent (feminine)' : 'Actrix'"
@click="refer({ categoria: 'nomen', referendum: (agendum as Agenda.ActusAgendus).actor('femininum') ?? undefined });" />
@click="refer({ categoria: 'nomen', referendum: 'actor', genus: 'femininum' });" />
</v-btn-toggle>
</template>
<template v-else-if="figura === 'nomenFactum'">
<v-btn append-icon='sprint' :text="lingua === 'anglica' ? 'Verb' : 'Actus'"
@click="refer({ categoria: 'actus', referendum: (agendum as Agenda.NomenFactum).actus() ?? undefined });" />
@click="refer({ categoria: 'actus' });" />
</template>
<template v-if="[
'adiectivumAgendum', 'incomparabile'
Expand All @@ -191,16 +237,14 @@
<v-btn append-icon='open_in_full'
:text="lingua === 'anglica' ? 'Substantiate' : 'Probetur'" @click="refer({
categoria: 'adiectivum',
referendum: (agendum as Agenda.AdiectivumAgendum).probetur({
gradus: et.gradus,
genus: et.genus
}) ?? undefined
gradus: et.gradus,
genus: et.genus
});" />
</template>
<template v-else-if="figura === 'incomparabile'">
<v-btn append-icon='open_in_full'
:text="lingua === 'anglica' ? 'Substantiate' : 'Probetur'"
@click="refer({ categoria: 'adiectivum', referendum: (agendum as Agenda.Incomparabile).probetur(et.genus) ?? undefined });" />
@click="refer({ categoria: 'adiectivum', genus: et.genus });" />
</template>
</span>
</template>
Expand All @@ -213,11 +257,11 @@
<template v-if='!onerans' v-slot:item='item'>
<template v-if="figura === 'numeramenAgendum'">
<v-btn :text="lingua === 'anglica' ? 'Open' : 'Refer'" append-icon='open_in_full'
@click='numeramen(item.item as Numeramen);' />
@click='numeramen(item.item);' />
</template>
<template v-else>
<v-btn :text="lingua === 'anglica' ? 'Inflect' : 'Inflecte'" append-icon='open_in_full'
@click='selige(item.item as Verbum)' />
@click='selige(item.item)' />
</template>
</template>
</v-data-table>
Expand Down
4 changes: 2 additions & 2 deletions src/praebeunda/agenda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import TabulaAdverbii from '../tabulae/adverbii';
import TabulaNumeraminis from '../tabulae/numeraminis';
import Tabula from '../tabulae/tabula';

export type Agendum<Hoc extends Verba.Multiplex> = Omit<Hoc, "categoria | enclicitum | unicum">;
export type Colamen<Hoc> = Omit<Hoc, "categoria | scriptum | encliticum">;
export type Agendum<Hoc extends Verba.Multiplex> = Omit<Hoc, "categoria" | "enclicitum" | "unicum">;
export type Colamen<Hoc> = Omit<Hoc, "categoria" | "scriptum" | "encliticum">;
export type Positor<Hoc extends Verba.Multiplex> = ((agendum: Agendum<Hoc>) => Hoc);

export class ActusAgendus implements Interfecta.Faciendum<Verba.Actus>, Interfecta.Lectum {
Expand Down

0 comments on commit 80ca564

Please sign in to comment.