-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
064ee2e
commit 5ecfcec
Showing
13 changed files
with
112 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Turso commands | ||
|
||
``` | ||
turso db shell <libsql://db-url.io> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getCardsRecorded, getCardsReviewed } from '$lib/db/tables/card.table.js'; | ||
|
||
export async function load({ locals }) { | ||
const reviewedInfo = getCardsReviewed(locals.user!.id) | ||
const recordedInfo = getCardsRecorded(locals.user!.id) | ||
|
||
return { | ||
reviewedInfo, | ||
recordedInfo | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script> | ||
import HeatmapCard from './HeatmapCard.svelte'; | ||
import Streak from './Streak.svelte'; | ||
export let data; | ||
</script> | ||
|
||
<div class="mx-auto mt-10 max-w-xl"> | ||
{#await data.reviewedInfo then info} | ||
<div class="mb-10"> | ||
<Streak data={info} /> | ||
</div> | ||
<HeatmapCard title={`${info.length} cards reviewed in last one year`} data={info} /> | ||
{/await} | ||
{#await data.recordedInfo then info} | ||
<HeatmapCard title={`${info.length} cards created in last one year`} data={info} /> | ||
{/await} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
export let data = []; | ||
export let title; | ||
import Heatmap from '$lib/components/Heatmap/Heatmap.svelte'; | ||
function convertDates(inputArray) { | ||
const dateCounts = {}; | ||
inputArray.forEach((item) => { | ||
const localDate = new Date(item.date).toLocaleDateString('en-CA'); | ||
if (dateCounts[localDate]) { | ||
dateCounts[localDate]++; | ||
} else { | ||
dateCounts[localDate] = 1; | ||
} | ||
}); | ||
const outputArray = Object.keys(dateCounts).map((date) => ({ | ||
date: date, | ||
count: dateCounts[date] | ||
})); | ||
return outputArray; | ||
} | ||
</script> | ||
|
||
<div> | ||
<h2>{title}</h2> | ||
<div class="my-4"> | ||
<Heatmap data={convertDates(data)} /> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts"> | ||
export let data = []; | ||
function calculateStreak(inputArray) { | ||
const dateSet = new Set( | ||
inputArray.map((item) => new Date(item.date).toLocaleDateString('en-CA')) | ||
); | ||
console.log(dateSet); | ||
const currentDate = new Date(); | ||
let streak = 0; | ||
while (dateSet.has(currentDate.toLocaleDateString('en-CA'))) { | ||
streak++; | ||
currentDate.setDate(currentDate.getDate() - 1); | ||
} | ||
return streak; | ||
} | ||
</script> | ||
|
||
<div> | ||
<h2 class="text-center">Current Streak: <span class="text-xl">{calculateStreak(data)}</span></h2> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
<script lang="ts"> | ||
import Heatmap from '$lib/components/Heatmap/Heatmap.svelte'; | ||
import AddNewCard from './AddNewCard.svelte'; | ||
import NewCards from './NewCards.svelte'; | ||
export let data; | ||
</script> | ||
|
||
<AddNewCard formData={data.addForm} /> | ||
|
||
<NewCards cards={data.cards} /> | ||
|
||
<div class="my-20 flex justify-center"> | ||
<Heatmap data={data.groupedInfo} /> | ||
</div> | ||
<NewCards cards={data.cards} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
<script lang="ts"> | ||
import Heatmap from '$lib/components/Heatmap/Heatmap.svelte'; | ||
import CardReview from '$lib/components/Cards/CardReview.svelte'; | ||
export let data; | ||
</script> | ||
|
||
{#await data.cards then cards} | ||
<CardReview {cards} /> | ||
{/await} | ||
|
||
{#await data.groupedInfo then groupedInfo} | ||
<div class="my-20 flex justify-center"> | ||
<Heatmap data={groupedInfo} /> | ||
</div> | ||
{/await} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters