-
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.
* move nav to home * Refactor DiaryEditor and Home components: - Add loading icon to DiaryEditor. - Remove unnecessary interval and styles from DiaryEditor. - Update navigation links in NavBar and Home. - Improve date navigation in Home. - Scope styles to components.
- Loading branch information
Showing
8 changed files
with
115 additions
and
59 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,13 @@ | ||
module Word | ||
|
||
open System | ||
|
||
let randomWords = | ||
[ ] // Add more words as needed | ||
|
||
let getRandomWord = | ||
fun ctx -> | ||
let random = Random() | ||
let word = randomWords.[random.Next(randomWords.Length)] | ||
// refresh note summary | ||
Falco.Request.mapRoute (ignore) (fun _ -> {| word = word |} |> Json.Response.ofJson) ctx |
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ export function parseJwt (token) { | |
}).join('')) | ||
|
||
return JSON.parse(jsonPayload) | ||
} | ||
} |
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,15 +1,98 @@ | ||
<template> | ||
<DiaryEditor :date="date"></DiaryEditor> | ||
<div class="content"> | ||
<div class="nav"> | ||
{{ time }} | ||
<div class="date-nav"> | ||
<div @click="navigateDate(-1)" class="icon-container"> | ||
<Icon icon="grommet-icons:form-previous" width="1.2rem" /> | ||
</div> | ||
<div> | ||
{{ displayDate }} | ||
</div> | ||
<div v-if="date < today" @click="navigateDate(1)" class="icon-container"> | ||
<Icon icon="grommet-icons:form-next" width="1.2rem" /> | ||
</div> | ||
<div v-if="date != today" @click="navigateDateToToday" class="icon-container"> | ||
<Icon icon="fluent:arrow-next-16-regular" width="1.2rem" /> | ||
</div> | ||
</div> | ||
<a href="/todo">Todo</a> | ||
<a href="content"> | ||
<Icon :icon="tableOfContents" /> | ||
</a> | ||
</div> | ||
<DiaryEditor :date="date"></DiaryEditor> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref, onMounted } from 'vue'; | ||
import { ref, computed, onMounted } from 'vue'; | ||
import moment from 'moment'; | ||
import { Icon } from '@iconify/vue2'; | ||
import tableOfContents from '@iconify/icons-mdi/table-of-contents'; | ||
import DiaryEditor from "@/components/DiaryEditor"; | ||
import { get_date_of_today } from "../util.js"; | ||
const date = ref(get_date_of_today()); | ||
const now = ref(moment()); | ||
const date = ref(moment().format('YYYYMMDD')) | ||
onMounted(() => { | ||
date.value = get_date_of_today(); | ||
// eslint-disable-next-line no-unused-vars | ||
date.value = now.value.format("YYYYMMDD") | ||
const interval = setInterval(() => now.value = moment(), 1000); | ||
}); | ||
const today = computed(() => { | ||
return now.value.format('YYYYMMDD'); | ||
}); | ||
const time = computed(() => { | ||
const timeFormat = 'h:mm:ss a'; | ||
return now.value.format(timeFormat); | ||
}); | ||
const displayDate = computed(() => { | ||
if (date.value == today.value) { | ||
return 'Today' | ||
} else { | ||
return date.value | ||
} | ||
}) | ||
function navigateDate(offset) { | ||
const newDate = moment(date.value).add(offset, 'days').format("YYYYMMDD"); | ||
if (newDate > today.value) { | ||
alert("can not into future") | ||
} | ||
date.value = newDate | ||
} | ||
function navigateDateToToday() { | ||
date.value = today.value | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.content { | ||
max-width: 65rem; | ||
margin: auto; | ||
} | ||
.nav { | ||
margin: 1em 1em 1rem 1em; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.nav .date-nav { | ||
display: flex; | ||
align-items: center; | ||
white-space: nowrap; | ||
} | ||
.icon-container { | ||
display: flex; | ||
align-items: center; | ||
} | ||
</style> |