Skip to content

Commit 044e5ab

Browse files
committed
fix: Improves display of Moons
1 parent e7bb7ba commit 044e5ab

File tree

6 files changed

+50
-15
lines changed

6 files changed

+50
-15
lines changed

src/agenda/Agenda.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script lang="ts">
22
import { getTypedContext } from "src/calendar/view.utils";
33
import Flags from "../calendar/ui/Events/Flags.svelte";
4-
import MoonUI from "../calendar/ui/Moon.svelte";
54
import { dateString } from "src/utils/functions";
65
import {
76
CALENDAR_SEARCH,
@@ -10,6 +9,8 @@
109
setClickableIcon,
1110
} from "src/utils/icons";
1211
import { derived, get } from "svelte/store";
12+
import MoonUI from "src/calendar/ui/Moons/Moon.svelte";
13+
1314
1415
const store = getTypedContext("store");
1516
const parent = getTypedContext("parent");

src/calendar/ui/Day/Day.svelte

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import Dots from "../Events/Dots.svelte";
44
import { TFile } from "obsidian";
55
import type { CalEvent } from "src/@types";
6-
import Moon from "../Moon.svelte";
76
import { ViewState } from "src/stores/calendar.store";
87
import Flags from "../Events/Flags.svelte";
98
import { addEventWithModal } from "src/events/modal/event";
@@ -15,6 +14,7 @@
1514
import { isCalEvent } from "src/events/event.types";
1615
import { openAgendaView } from "src/agenda/view.agenda";
1716
import { getTypedContext } from "src/calendar/view.utils";
17+
import MoonContainer from "../Moons/MoonContainer.svelte";
1818
1919
export let month: MonthStore;
2020
export let day: DayOrLeapDay;
@@ -185,11 +185,7 @@
185185
{#key $events}
186186
{#if $full && $viewState != ViewState.Year}
187187
{#if $displayMoons}
188-
<div class="moon-container">
189-
{#each $moons as moon}
190-
<Moon {moon} />
191-
{/each}
192-
</div>
188+
<MoonContainer moons={$moons} />
193189
{/if}
194190
{#key $events}
195191
<Flags events={$events} />
@@ -243,9 +239,4 @@
243239
.opened {
244240
border: 2px solid var(--background-modifier-border);
245241
}
246-
247-
/* .moon-container {
248-
display: flex;
249-
flex-flow: row;
250-
} */
251242
</style>
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
$: path = SHADOW_MAP[moon.phase ?? "New moon"];
1010
</script>
1111

12-
<div aria-label={label ? `${moon.name}\n${moon.phase}` : null}>
12+
<div
13+
class="moon-wrapper"
14+
aria-label={label ? `${moon.name}\n${moon.phase}` : null}
15+
>
1316
<svg
1417
class="moon"
1518
id={moon.id}
@@ -32,4 +35,14 @@
3235
</div>
3336

3437
<style>
38+
.moon-wrapper,
39+
.moon {
40+
width: min-content;
41+
height: min-content;
42+
min-width: 0;
43+
}
44+
.moon {
45+
display: flex;
46+
align-items: center;
47+
}
3548
</style>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script lang="ts">
2+
import Moon from "./Moon.svelte";
3+
import type { MoonState } from "src/schemas/calendar/moons";
4+
5+
export let moons: MoonState[] = [];
6+
export let dayView: boolean = false;
7+
8+
/* export */ let width: number;
9+
10+
let target: HTMLElement;
11+
</script>
12+
13+
<div class="moon-container" class:full={!dayView} bind:this={target}>
14+
<div class="left-button"></div>
15+
<div class="moons">
16+
{#if target != null}
17+
{#each moons as moon}
18+
<Moon {moon} />
19+
{/each}
20+
{/if}
21+
</div>
22+
<div class="right-button"></div>
23+
</div>
24+
25+
<style>
26+
.moons {
27+
display: inline-flex;
28+
overflow-y: scroll;
29+
}
30+
</style>

src/calendar/ui/Week/Week.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<style scoped>
6262
.week {
6363
display: grid;
64-
grid-template-columns: repeat(var(--calendar-columns), 1fr);
64+
grid-template-columns: repeat(var(--calendar-columns), minmax(0, 1fr));
6565
text-align: center;
6666
}
6767
.week-number {

src/settings/creator/Containers/celestials/moons/MoonInstance.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { ExtraButtonComponent } from "obsidian";
3-
import MoonSVG from "src/calendar/ui/Moon.svelte";
3+
import MoonSVG from "src/calendar/ui/Moons/Moon.svelte";
44
import type { Moon } from "src/schemas/calendar/moons";
55
import { EDIT, TRASH, setNodeIcon } from "src/utils/icons";
66
import { MOON_CYCLE, MOON_OFFSET } from "src/utils/icons";

0 commit comments

Comments
 (0)