@axium/calendar 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/calendar",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Calendar for Axium",
6
6
  "funding": {
@@ -13,8 +13,9 @@
13
13
 
14
14
  const { user } = data.session;
15
15
 
16
- const today = new Date();
17
- today.setHours(0, 0, 0, 0);
16
+ const now = new SvelteDate();
17
+ setInterval(() => now.setTime(Date.now()), 60_000);
18
+ const today = $derived(new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0));
18
19
 
19
20
  let start = new SvelteDate(data.filter.start);
20
21
  let end = new SvelteDate(data.filter.end);
@@ -61,7 +62,6 @@
61
62
  <button class="event-init icon-text" command="show-modal" commandfor="event-init"><Icon i="plus" /> New Event</button>
62
63
  <div class="bar">
63
64
  <button onclick={() => start.setTime(today.getTime())}>Today</button>
64
- <span class="label">{weekDays[0].toLocaleString('default', { month: 'long', year: 'numeric' })}</span>
65
65
  <button
66
66
  style:display="contents"
67
67
  onclick={() => {
@@ -76,6 +76,7 @@
76
76
  end.setDate(end.getDate() + spanDays);
77
77
  }}><Icon i="chevron-right" /></button
78
78
  >
79
+ <span class="label">{weekDays[0].toLocaleString('default', { month: 'long', year: 'numeric' })}</span>
79
80
  </div>
80
81
  <div id="cal-list">
81
82
  <Calendar.Select bind:start bind:end />
@@ -190,7 +191,7 @@
190
191
  class="reset"
191
192
  onclick={() => (eventEditId = event.id)}
192
193
  command="show-modal"
193
- commandfor="event-delete"><Icon i="trash" /></button
194
+ commandfor="event-delete"><Icon i="trash-can" /></button
194
195
  >
195
196
  <button class="reset" command="hide-popover" commandfor="event-popover:{event.id}"
196
197
  ><Icon i="xmark" /></button
@@ -249,6 +250,10 @@
249
250
  {/if}
250
251
  </Popover>
251
252
  {/each}
253
+
254
+ {#if today.getTime() == day.getTime()}
255
+ <div class="now" style:top="{(now.getHours() * 60 + now.getMinutes()) / 14.4}%"></div>
256
+ {/if}
252
257
  </div>
253
258
  </div>
254
259
  {/each}
@@ -567,10 +572,29 @@
567
572
  .day-content {
568
573
  flex-grow: 1;
569
574
  position: relative;
575
+
576
+ .now {
577
+ position: absolute;
578
+ width: 100%;
579
+ border-bottom: 1px solid hsl(0 33 var(--fg-light));
580
+ z-index: 9;
581
+ pointer-events: none;
582
+
583
+ &::before {
584
+ content: '';
585
+ position: absolute;
586
+ left: -0.25em;
587
+ top: -0.25em;
588
+ width: 0.5em;
589
+ height: 0.5em;
590
+ border-radius: 50%;
591
+ background-color: hsl(0 33 var(--fg-light));
592
+ }
593
+ }
570
594
  }
571
595
 
572
596
  .event {
573
- width: 100%;
597
+ width: calc(100% - 0.5em);
574
598
  position: absolute;
575
599
  border-radius: 0.5em;
576
600
  padding: 0.25em;