Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions src/lib/components/ColorCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ TODO:
-->
<script lang="ts">
import { base } from '$app/paths';
import { refs } from '$lib/data/stores';
import config from '$lib/data/config';
import { direction, refs } from '$lib/data/stores';
import CardMenu from './CardMenu.svelte';

export let docSet = '';
export let collection = '';
export let book = '';
export let chapter = '';
export let reference = '';
Expand All @@ -18,12 +20,33 @@ TODO:
export let verse = '';
export let actions = [''];
export let penColor = 1;
const bc = config.bookCollections.find((x) => x.id === collection);
const textDirection = bc.style.textDirection.toLowerCase();
$: justifyStart =
($direction === 'ltr' && textDirection === 'ltr') ||
($direction === 'rtl' && textDirection === 'rtl');
$: justifyEnd = $direction === 'rtl' && textDirection === 'ltr';

function annotationStyles(style: string) {
let styles = style;
if (collection) {
styles = styles + ` ${style}-bc${collection}`;
if (book) {
styles = styles + ` ${style}-bc${collection}-bk${book}`;
}
}
return styles;
}
</script>

<div class="annotation-item-block dy-card">
<div class="color-card">
<div class="annotation-item-color {'hlp' + penColor.toString()} self-center"></div>
<div class="annotation-item-reference justify-self-start self-center">
<div
class="{annotationStyles('annotation-item-reference')} self-center"
class:justify-self-end={justifyEnd}
class:justify-self-start={justifyStart}
>
<a
style="text-decoration:none;"
href="{base}/"
Expand All @@ -33,7 +56,11 @@ TODO:
</a>
</div>
<div class="self-center justify-self-end"><CardMenu on:menuaction {actions} /></div>
<div class="annotation-item-text col-start-2 col-end-3">
<div
class="{annotationStyles('annotation-item-text')} col-start-2 col-end-3"
class:justify-self-end={justifyEnd}
class:justify-self-start={justifyStart}
>
<a
style="text-decoration:none;"
href="{base}/"
Expand Down
24 changes: 20 additions & 4 deletions src/lib/components/IconCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,22 @@ TODO:
export let src = '';
export let alt = '';
const bc = config.bookCollections.find((x) => x.id === collection);
const textDirection = bc.style.textDirection;
$: justifyEnd = textDirection.toLowerCase() === 'rtl' && $direction === 'ltr';
const textDirection = bc.style.textDirection.toLowerCase();
$: justifyStart =
($direction === 'ltr' && textDirection === 'ltr') ||
($direction === 'rtl' && textDirection === 'rtl');
$: justifyEnd = $direction === 'rtl' && textDirection === 'ltr';

function annotationStyles(style: string) {
let styles = style;
if (collection) {
styles = styles + ` ${style}-bc${collection}`;
if (book) {
styles = styles + ` ${style}-bc${collection}-bk${book}`;
}
}
return styles;
}
</script>

<div class="annotation-item-block dy-card">
Expand All @@ -36,8 +50,9 @@ TODO:
{/if}
</div>
<div
class="annotation-item-reference justify-self-start self-center"
class="{annotationStyles('annotation-item-reference')} self-center"
class:justify-self-end={justifyEnd}
class:justify-self-start={justifyStart}
>
<a
style="text-decoration:none;"
Expand All @@ -50,8 +65,9 @@ TODO:
<div class="self-center justify-self-end"><CardMenu on:menuaction {actions} /></div>

<div
class="annotation-item-text col-start-2 col-end-3 justify-self-start"
class="{annotationStyles('annotation-item-text')} col-start-2 col-end-3"
class:justify-self-end={justifyEnd}
class:justify-self-start={justifyStart}
>
<a
style="text-decoration:none;"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/data/bookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function getBookmarks(): Promise<BookmarkItem[]> {

function notifyUpdated() {
bookmarksLastUpdated.set(Date.now());
invalidate('bookmarks');
invalidate('idb:bookmarks');
}

export const bookmarksLastUpdated = writable(Date.now());
2 changes: 1 addition & 1 deletion src/lib/data/highlights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function getHighlights(): Promise<HighlightItem[]> {

function notifyUpdated() {
highlightsLastUpdated.set(Date.now());
invalidate('highlights');
invalidate('idb:highlights');
}

export const highlightsLastUpdated = writable(Date.now());
2 changes: 1 addition & 1 deletion src/lib/data/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export async function getNotes(): Promise<NoteItem[]> {

function notifyUpdated() {
notesLastUpdated.set(Date.now());
invalidate('notes');
invalidate('idb:notes');
}

export const notesLastUpdated = writable(Date.now());
2 changes: 1 addition & 1 deletion src/lib/data/planProgressItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export async function getNextPlanReference(
}
function notifyUpdatedPlanStates() {
planProgressItemsLastUpdated.set(Date.now());
invalidate('planprogressitems');
invalidate('idb:planprogressitems');
}

export const planProgressItemsLastUpdated = writable(Date.now());
2 changes: 1 addition & 1 deletion src/lib/data/planStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ export async function addPlanState(item: { id: string; state: string }) {

function notifyUpdatedPlanStates() {
planStatesLastUpdated.set(Date.now());
invalidate('planstates');
invalidate('idb:planstates');
}
export const planStatesLastUpdated = writable(Date.now());
2 changes: 1 addition & 1 deletion src/routes/bookmarks/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export async function load({ depends }) {
const bookmarks = allBookmarks.filter((item) => {
return config.bookCollections.some((collection) => collection.id === item.collection);
});
depends('bookmarks');
depends('idb:bookmarks');
return { bookmarks };
}
5 changes: 5 additions & 0 deletions src/routes/bookmarks/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import IconCard from '$lib/components/IconCard.svelte';
import Navbar from '$lib/components/Navbar.svelte';
Expand Down Expand Up @@ -46,6 +47,10 @@
let sortOrder = SORT_DATE;
</script>

<svelte:head>
<link rel="stylesheet" href="{base}/styles/sab-annotations.css" />
</svelte:head>

<div class="grid grid-rows-[auto,1fr]" style="height:100vh;height:100dvh;">
<div class="navbar">
<Navbar>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/highlights/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export async function load({ depends }) {
const highlights = allHighlights.filter((item) => {
return config.bookCollections.some((collection) => collection.id === item.collection);
});
depends('highlights');
depends('idb:highlights');
return { highlights };
}
6 changes: 6 additions & 0 deletions src/routes/highlights/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import ColorCard from '$lib/components/ColorCard.svelte';
import Navbar from '$lib/components/Navbar.svelte';
Expand Down Expand Up @@ -52,6 +53,10 @@
let sortOrder = SORT_DATE;
</script>

<svelte:head>
<link rel="stylesheet" href="{base}/styles/sab-annotations.css" />
</svelte:head>

<div class="grid grid-rows-[auto,1fr]" style="height:100vh;height:100dvh;">
<div class="navbar">
<Navbar>
Expand Down Expand Up @@ -88,6 +93,7 @@
{#each toSorted($page.data.highlights, sortOrder) as h}
{@const colorCard = {
docSet: h.docSet,
collection: h.collection,
book: h.book,
chapter: h.chapter,
verse: h.verse,
Expand Down
3 changes: 1 addition & 2 deletions src/routes/notes/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export async function load({ depends }) {
const notes = allNotes.filter((item) => {
return config.bookCollections.some((collection) => collection.id === item.collection);
});
depends('notes');
console.log('Notes', notes);
depends('idb:notes');
return { notes };
}
5 changes: 5 additions & 0 deletions src/routes/notes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import IconCard from '$lib/components/IconCard.svelte';
import Navbar from '$lib/components/Navbar.svelte';
Expand Down Expand Up @@ -49,6 +50,10 @@
let sortOrder = SORT_DATE;
</script>

<svelte:head>
<link rel="stylesheet" href="{base}/styles/sab-annotations.css" />
</svelte:head>

<div class="grid grid-rows-[auto,1fr]" style="height:100vh;height:100dvh;">
<div class="navbar">
<Navbar>
Expand Down