Skip to content

Commit f1a5ff4

Browse files
committed
feat: use cdn package instead of package. Load other saints celebration
1 parent 7228bbf commit f1a5ff4

5 files changed

Lines changed: 38 additions & 19 deletions

File tree

index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020

2121
gtag('config', 'G-MM16SMDYR9');
2222
</script>
23+
2324
</head>
2425
<body>
2526
<div id="app"></div>
27+
<script type="module">
28+
import Sanctus from 'https://cdn.jsdelivr.net/npm/sanctus/+esm';
29+
window.sanctus = new Sanctus();
30+
</script>
2631
<script src="/src/main.ts" type="module"></script>
2732
</body>
2833
</html>

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
},
1111
"dependencies": {
1212
"vue": "^3.4.38",
13-
"sanctus": "^1.0.0",
1413
"@vuepic/vue-datepicker": "^7.4.0",
1514
"lucide-vue-next": "^0.344.0"
1615
},

src/assets/vue.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/CardSaintSelector.vue

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,33 @@
8888
</div>
8989
</template>
9090
<script lang="ts" setup>
91-
import {SaintInfo, Sanctus} from 'sanctus';
9291
import {computed, ComputedRef, onMounted, Ref, ref} from 'vue';
93-
import { Calendar, ChevronLeft, ChevronRight } from 'lucide-vue-next'
92+
import {Calendar, ChevronLeft, ChevronRight} from 'lucide-vue-next'
93+
94+
interface SaintInfo {
95+
name: string;
96+
birth?: string;
97+
dead?: string;
98+
meaning?: string;
99+
description?: string;
100+
shortDescription?: string;
101+
}
102+
103+
interface SanctusInfo {
104+
getSaint(date: Date): SaintInfo | null;
105+
106+
getAllSaints(): SaintInfo[];
107+
108+
getSaintsOfDay(date: Date): SaintInfo[];
109+
}
110+
111+
declare global {
112+
interface Window {
113+
sanctus: SanctusInfo;
114+
}
115+
}
94116
95-
// Initialize Sanctus
96-
const sanctus = new Sanctus();
117+
const sanctus = window.sanctus;
97118
98119
// State
99120
const selectedDate = ref(new Date());
@@ -132,33 +153,28 @@ const otherSaints = computed(() => {
132153
});
133154
134155
// Methods
135-
function loadSaints(){
156+
function loadSaints() {
136157
// Get all saints for the selected date
137158
const allSaints = [];
138159
139160
const mainSaint = sanctus.getSaint(selectedDate.value);
140-
console.log("mainSaint", mainSaint);
141161
if (mainSaint) {
142162
allSaints.push(mainSaint);
143163
}
144164
145-
// const month = selectedDate.value.getMonth() + 1;
146-
// const day = selectedDate.value.getDate();
147-
//
148-
// const otherSaints = sanctus.getSaintsOfDay(month, day);
149-
// allSaints.push(...otherSaints.filter(s => s.name !== mainSaint?.name));
150-
//
165+
const otherSaints = sanctus.getSaintsOfDay(selectedDate.value);
166+
allSaints.push(...otherSaints.slice(1));
151167
saints.value = allSaints;
152168
}
153169
154-
function previousDay(){
170+
function previousDay() {
155171
const prevDate = new Date(selectedDate.value);
156172
prevDate.setDate(prevDate.getDate() - 1);
157173
selectedDate.value = prevDate;
158174
loadSaints();
159175
}
160176
161-
function nextDay(){
177+
function nextDay() {
162178
const nextDate = new Date(selectedDate.value);
163179
nextDate.setDate(nextDate.getDate() + 1);
164180
selectedDate.value = nextDate;

0 commit comments

Comments
 (0)