-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from fumeapp/shotday
🚧 laying some ground wrok
- Loading branch information
Showing
10 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup lang="ts"> | ||
import type { Pen } from '~/types/models' | ||
const props = defineProps<{ pen: Pen }>() | ||
const emit = defineEmits(['updated']) | ||
const route = useRoute() | ||
const isShotDayToday = computed((): boolean => | ||
weekDays[new Date().getDay()]?.toLowerCase() === props.pen.shotDay?.toLowerCase(), | ||
) | ||
const update = (day?: string) => { | ||
useApi() | ||
.api( | ||
route.params.user ? `/api/user/${route.params.user}/pen/${props.pen.id}` : `/api/pen/${props.pen.id}`, | ||
{ method: 'PUT', body: { cartridgeId: props.pen.cartridgeId, shotDay: day || undefined } }, | ||
) | ||
.then(() => emit('updated')) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div v-if="!pen.shotDay" class="flex flex-col space-y-2 items-center"> | ||
<u-button-group> | ||
<u-button | ||
v-for="day in weekDays" | ||
:key="day" | ||
:label="day" | ||
color="white" | ||
@click="update(day)" | ||
/> | ||
</u-button-group> | ||
<span class="text-sm">Choose a shot day to help you remember</span> | ||
</div> | ||
<div v-else class="flex items-center space-x-1"> | ||
<span> Your shot day is </span> | ||
<u-badge :label="weekdayToFull(pen.shotDay)" variant="soft" size="lg" /> | ||
<u-button :ui="{ rounded: 'rounded-full' }" icon="i-mdi-close" size="xs" variant="ghost" square @click="update()" /> | ||
</div> | ||
<u-alert | ||
v-if="isShotDayToday" | ||
icon="i-mdi-alert" | ||
title="Shot day is today" | ||
description="Don't forget to take your shot and log it!" | ||
color="emerald" | ||
/> | ||
</template> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "mysql" | ||
provider = "mysql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters