Skip to content

Commit

Permalink
basic member view
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaomiDEV committed May 7, 2024
1 parent 2ecbac9 commit f238814
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
36 changes: 36 additions & 0 deletions src/components/MemberInList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script setup lang="ts">
import {
IonItemSliding,
IonItem,
IonAvatar,
IonLabel,
IonItemOptions,
IonItemOption
} from "@ionic/vue";
import { Member, getTable } from '../lib/db/entities/members';
import { getBlobURL } from '../lib/util/blob';
const { member } = defineProps<{
member: Member
}>();
async function removeFromDatabase() {
await getTable().delete(member.uuid);
}
</script>

<template>
<IonItemSliding :key="member.uuid">
<IonItem>
<IonAvatar slot="start" v-if="member.image">
<img aria-hidden="true" :src="getBlobURL(member.image)" />
</IonAvatar>
<IonLabel>{{ member.name }}</IonLabel>
<!-- TODO: Add tags as chips -> @mecha-cat -->
</IonItem>
<IonItemOptions>
<IonItemOption color="danger" @click="removeFromDatabase()">Delete</IonItemOption>
</IonItemOptions>
</IonItemSliding>
</template>
28 changes: 25 additions & 3 deletions src/views/tabbed/Members.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/vue';
import { inject } from 'vue';
import { IonContent, IonHeader, IonLabel, IonList, IonPage, IonSearchbar, IonTitle, IonToolbar } from '@ionic/vue';
import { inject, ref } from 'vue';
import { getFilteredMembers } from '../../lib/db/liveQueries';
import MemberInList from '../../components/MemberInList.vue';
const isIOS = inject<boolean>("isIOS");
const search = ref("");
const members = getFilteredMembers(search);
</script>

<template>
<IonPage>
<IonHeader>
<IonToolbar>
<IonTitle>
Members
{{ $t("members:header") }}
</IonTitle>
</IonToolbar>
<IonToolbar>
<IonSearchbar
:debounce="1000"
:animated="true"
:placeholder="$t('members:searchPlaceholder')"
showCancelButton="focus"
showClearButton="focus"
:spellcheck="false"
v-model="search"
/>
</IonToolbar>
</IonHeader>

<IonContent>
<IonList :inset="isIOS">

<!-- FIXME: Remove this when modal is done -->
<IonLabel>
TODO: Member add/edit modal. If you want to test this view, add a member through Testing Grounds
</IonLabel>

<MemberInList v-for="member in members" :member />
</IonList>
</IonContent>
</IonPage>
Expand Down
4 changes: 4 additions & 0 deletions translations/en/members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"header": "Members",
"searchPlaceholder": "Search members..."
}

0 comments on commit f238814

Please sign in to comment.