-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
268 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ dist-ssr | |
*.sw? | ||
.env | ||
/certs/* | ||
/vite.config.d.ts | ||
/vite.config.js |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,56 @@ | ||
<template> | ||
<div | ||
ref="viewableTarget" | ||
class="w-full" | ||
:class="['transition-opacity duration-500 ease-in', isViewable ? 'opacity-100' : 'opacity-0']" | ||
> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { onMounted, ref } from "vue"; | ||
interface Props { | ||
threshold?: number; | ||
delay?: number; | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
threshold: 0.25, | ||
delay: 0, | ||
}); | ||
const isViewable = ref(false); | ||
const viewableTarget = ref<HTMLElement | null>(null); | ||
const onIntersection: IntersectionObserverCallback = (entries) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
setTimeout( | ||
() => { | ||
isViewable.value = true; | ||
}, | ||
(props.delay + 0.05) * 1000 | ||
); | ||
} | ||
}); | ||
}; | ||
const setupObserver = (): void => { | ||
const options: IntersectionObserverInit = { | ||
root: null, | ||
rootMargin: "0px", | ||
threshold: props.threshold, | ||
}; | ||
const observer = new IntersectionObserver(onIntersection, options); | ||
if (viewableTarget.value) { | ||
observer.observe(viewableTarget.value); | ||
} | ||
}; | ||
onMounted(() => { | ||
setupObserver(); | ||
}); | ||
</script> |
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,19 @@ | ||
<template> | ||
<transition name="fade" mode="out-in"> | ||
<slot></slot> | ||
</transition> | ||
</template> | ||
|
||
<script lang="ts" setup></script> | ||
|
||
<style scoped> | ||
.fade-enter-active, | ||
.fade-leave-active { | ||
transition: opacity 0.5s ease; | ||
} | ||
.fade-enter-from, | ||
.fade-leave-to { | ||
opacity: 0; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<div | ||
class="flex justify-center items-center" | ||
:style="{ width: `${props.width}px`, height: `${props.height}px`, background: props.background }" | ||
> | ||
<img src="@/assets/logo-circle.png" class="w-20 animate-spin" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
interface Props { | ||
width?: number; | ||
height?: number; | ||
background?: string; | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
width: 200, | ||
height: 200, | ||
background: "#052344", | ||
}); | ||
</script> | ||
|
||
<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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<svg | ||
class="animate-spin -ml-1 mr-3 h-5 w-5" | ||
:class="props.dark ? 'text-white' : 'text-gray-500'" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
> | ||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> | ||
<path | ||
class="opacity-75" | ||
fill="currentColor" | ||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" | ||
></path> | ||
</svg> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { defineProps } from "vue"; | ||
const props = defineProps<{ | ||
dark?: boolean; | ||
}>(); | ||
</script> | ||
|
||
<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 was deleted.
Oops, something went wrong.
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,44 @@ | ||
import { defineStore } from "pinia"; | ||
import { API } from "@/utils/api"; | ||
import { Facility } from "@/types"; | ||
|
||
interface FacilityState { | ||
facilities: Facility[] | null; | ||
error: string | null; | ||
fetching: boolean; | ||
hasFetched: boolean; | ||
loading: Promise<void> | null; | ||
} | ||
|
||
const useFacilityStore = defineStore({ | ||
id: "facility", | ||
state: () => | ||
({ | ||
facilities: null, | ||
error: null, | ||
fetching: false, | ||
hasFetched: false, | ||
}) as FacilityState, | ||
getters: { | ||
getFacility: (state) => (id: string) => { | ||
if (!state.facilities) return null; | ||
return state.facilities.find((facility) => facility.id === id) || null; | ||
}, | ||
}, | ||
actions: { | ||
async fetchFacilities(): Promise<void> { | ||
this.fetching = true; | ||
try { | ||
const { data } = await API.get("/v3/facility"); | ||
this.facilities = data; | ||
} catch (e) { | ||
this.facilities = []; | ||
} finally { | ||
this.fetching = false; | ||
this.hasFetched = true; | ||
} | ||
}, | ||
}, | ||
}); | ||
|
||
export default useFacilityStore; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.