classcard-ui 0.2.1520 → 0.2.1521
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classcard-ui.common.js +81 -80
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +81 -80
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CCalendar/CCalendar.vue +28 -31
- package/src/stories/CCalendar.stories.js +6 -2
package/package.json
CHANGED
|
@@ -115,25 +115,37 @@
|
|
|
115
115
|
>
|
|
116
116
|
<span
|
|
117
117
|
v-for="(dot, i) in getDayGlyphs(date).dots"
|
|
118
|
-
:key="dot + '-' + i"
|
|
118
|
+
:key="dot.status + '-' + i"
|
|
119
119
|
class="flex"
|
|
120
120
|
>
|
|
121
121
|
<c-icon
|
|
122
|
-
v-if="dot === 'cancelled'"
|
|
122
|
+
v-if="dot.status === 'cancelled'"
|
|
123
123
|
name="x-mark-solid-v2"
|
|
124
124
|
type="solid"
|
|
125
125
|
viewBox="0 0 24 24"
|
|
126
126
|
class="h-3 w-3 text-red-600"
|
|
127
127
|
cursor-type="cursor-pointer"
|
|
128
128
|
></c-icon>
|
|
129
|
+
<c-icon
|
|
130
|
+
v-else-if="dot.status === 'awaiting'"
|
|
131
|
+
name="clock-outline"
|
|
132
|
+
type="outline"
|
|
133
|
+
class="h-3 w-3 text-yellow-600"
|
|
134
|
+
cursor-type="cursor-pointer"
|
|
135
|
+
></c-icon>
|
|
129
136
|
<span
|
|
130
137
|
v-else
|
|
131
138
|
class="block h-2 w-2 rounded-full"
|
|
132
139
|
:class="{
|
|
133
|
-
'bg-green-600':
|
|
134
|
-
|
|
135
|
-
'bg-gray-400': dot === 'unknown',
|
|
140
|
+
'bg-green-600':
|
|
141
|
+
dot.status === 'confirmed' && !dot.color,
|
|
142
|
+
'bg-gray-400': dot.status === 'unknown',
|
|
136
143
|
}"
|
|
144
|
+
:style="
|
|
145
|
+
dot.status === 'confirmed' && dot.color
|
|
146
|
+
? { backgroundColor: dot.color }
|
|
147
|
+
: null
|
|
148
|
+
"
|
|
137
149
|
></span>
|
|
138
150
|
</span>
|
|
139
151
|
<span
|
|
@@ -146,28 +158,6 @@
|
|
|
146
158
|
</div>
|
|
147
159
|
</div>
|
|
148
160
|
</div>
|
|
149
|
-
|
|
150
|
-
<div class="flex items-center justify-center gap-x-5 gap-y-1 py-3">
|
|
151
|
-
<div class="flex items-center gap-1.5">
|
|
152
|
-
<span class="block h-2 w-2 rounded-full bg-green-600"></span>
|
|
153
|
-
<p class="text-sm text-gray-500">Confirmed</p>
|
|
154
|
-
</div>
|
|
155
|
-
<div class="flex items-center gap-1.5">
|
|
156
|
-
<span
|
|
157
|
-
class="block h-2 w-2 rounded-full border-2 border-yellow-600"
|
|
158
|
-
></span>
|
|
159
|
-
<p class="text-sm text-gray-500">Awaiting</p>
|
|
160
|
-
</div>
|
|
161
|
-
<div class="flex items-center gap-1.5">
|
|
162
|
-
<c-icon
|
|
163
|
-
name="x-mark-solid-v2"
|
|
164
|
-
type="solid"
|
|
165
|
-
viewBox="0 0 24 24"
|
|
166
|
-
class="h-4 w-4 text-red-600"
|
|
167
|
-
></c-icon>
|
|
168
|
-
<p class="text-sm text-gray-500">Cancelled</p>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
161
|
</div>
|
|
172
162
|
<slot name="customCardsRender"></slot>
|
|
173
163
|
<section
|
|
@@ -200,7 +190,10 @@
|
|
|
200
190
|
@click="handleEventClick(event)"
|
|
201
191
|
>
|
|
202
192
|
<div class="flex items-start justify-between gap-2">
|
|
203
|
-
<div
|
|
193
|
+
<div
|
|
194
|
+
class="text-sm text-gray-900"
|
|
195
|
+
:class="event.status === 7 ? 'line-through' : ''"
|
|
196
|
+
>
|
|
204
197
|
{{ formatTimeFromDate(event.start) }} -
|
|
205
198
|
{{ formatTimeFromDate(event.end) }}
|
|
206
199
|
</div>
|
|
@@ -479,8 +472,12 @@ export default {
|
|
|
479
472
|
);
|
|
480
473
|
if (!dayEvents.length) return null;
|
|
481
474
|
let sorted = dayEvents
|
|
482
|
-
.map((event) =>
|
|
483
|
-
|
|
475
|
+
.map((event) => ({
|
|
476
|
+
status: this.eventStatus(event),
|
|
477
|
+
// Confirmed dots take the subject category color of the class.
|
|
478
|
+
color: event.color,
|
|
479
|
+
}))
|
|
480
|
+
.sort((a, b) => rank[a.status] - rank[b.status]);
|
|
484
481
|
return {
|
|
485
482
|
dots: sorted.slice(0, sorted.length > 2 ? 1 : 2),
|
|
486
483
|
extra: sorted.length > 2 ? sorted.length - 1 : 0,
|
|
@@ -495,7 +492,7 @@ export default {
|
|
|
495
492
|
if (!entry || !entry.eventsCount) return null;
|
|
496
493
|
let shown = Math.min(entry.eventsCount, 2);
|
|
497
494
|
return {
|
|
498
|
-
dots: Array(shown).fill("unknown"),
|
|
495
|
+
dots: Array(shown).fill({ status: "unknown" }),
|
|
499
496
|
extra: entry.eventsCount - shown,
|
|
500
497
|
};
|
|
501
498
|
},
|
|
@@ -24,10 +24,11 @@ const statusFields = {
|
|
|
24
24
|
cancelled: { status: 7, isConfirmed: 1 },
|
|
25
25
|
};
|
|
26
26
|
const colors = {
|
|
27
|
-
confirmed: "#047857",
|
|
28
27
|
awaiting: "#1D4ED8",
|
|
29
28
|
cancelled: "#DC2626",
|
|
30
29
|
};
|
|
30
|
+
// Confirmed dots are tinted with the class's subject category color.
|
|
31
|
+
const categoryColors = ["#7C3AED", "#EA580C", "#0D9488", "#DB2777", "#4F46E5"];
|
|
31
32
|
|
|
32
33
|
// day-of-month -> ordered list of class statuses for that day
|
|
33
34
|
const spec = {
|
|
@@ -46,7 +47,10 @@ const eventsData = Object.entries(spec).flatMap(([d, list]) =>
|
|
|
46
47
|
start: at(+d, 9 + i),
|
|
47
48
|
end: at(+d, 10 + i),
|
|
48
49
|
title: `${st[0].toUpperCase() + st.slice(1)} class`,
|
|
49
|
-
color:
|
|
50
|
+
color:
|
|
51
|
+
st === "confirmed"
|
|
52
|
+
? categoryColors[id % categoryColors.length]
|
|
53
|
+
: colors[st],
|
|
50
54
|
duration: 60,
|
|
51
55
|
subject: "Intermediate Course",
|
|
52
56
|
staff: "Jyoti Karna",
|