Skip to content

Commit

Permalink
✨ Star points & checkins
Browse files Browse the repository at this point in the history
  • Loading branch information
homostellaris committed Jan 27, 2025
1 parent 39606c9 commit 6f428ba
Show file tree
Hide file tree
Showing 14 changed files with 515 additions and 130 deletions.
20 changes: 20 additions & 0 deletions components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
cloudDownloadSharp,
cloudOfflineSharp,
cloudUploadSharp,
starSharp,
thunderstormSharp,
} from 'ionicons/icons'
import { db } from '../db'
Expand All @@ -36,6 +37,25 @@ export const Header = ({ title }: { title: string }) => {
className="w-10 h-10 ml-2" // Needs to align with starship and trajectory
/>
<IonTitle>{title}</IonTitle>
{/* <IonButton
className="ml-4"
fill="clear"
id="star-points"
>
<IonIcon
icon={starSharp}
slot="icon-only"
></IonIcon>
<IonPopover
trigger="star-points"
triggerAction="click"
>
<IonContent class="ion-padding">
Star points this week: 9
</IonContent>
</IonPopover>
<span className="ml-3 font-mono text-xl">9</span>
</IonButton> */}
<IonButtons
className="mx-2"
slot="secondary"
Expand Down
39 changes: 39 additions & 0 deletions components/common/starScale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const starScale = {
0: {
ionicColor: 'success',
textColor: 'text-white',
tailwindBgColors: 'bg-white',
},
1: {
ionicColor: 'medium',
textColor: 'text-rose-400',
tailwindBgColors: 'bg-rose-200',
},
2: {
ionicColor: 'danger',
textColor: 'text-pink-400',
tailwindBgColors: 'bg-pink-200',
},
3: {
ionicColor: 'warning',
textColor: 'text-fuchsia-400',
tailwindBgColors: 'bg-fuchsia-200',
},
5: {
ionicColor: 'tertiary',
textColor: 'text-violet-400',
tailwindBgColors: 'bg-violet-200',
},
8: {
ionicColor: 'secondary',
textColor: 'text-indigo-400',
tailwindBgColors: 'bg-indigo-200',
},
13: {
ionicColor: 'primary',
textColor: 'text-blue-400',
tailwindBgColors: 'bg-blue-200',
},
}

export default starScale
17 changes: 16 additions & 1 deletion components/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface Todo {
id: string
note?: Note
starRole?: StarRole['id'] // TODO: How do we delete this when the star role is deleted? Need to add associative table and compute ID of association from todo ID and starRoleID, then delete entries when star roles gets deleted.
starPoints?: string
starPoints?: number
title: string
}

Expand Down Expand Up @@ -52,7 +52,13 @@ export interface Setting {
value: any
}

export interface Checkin {
todoId: string
date: Date
}

export class DexieStarfocus extends Dexie {
checkins: DexieCloudTable<Checkin, 'todoId'>
wayfinderOrder!: DexieCloudTable<WayfinderOrder, 'todoId'>
lists!: Table<List>
settings!: DexieCloudTable<Setting, 'key'>
Expand Down Expand Up @@ -107,6 +113,15 @@ export class DexieStarfocus extends Dexie {
starRolesOrder: '&starRoleId, order',
todos: '@id, createdAt, completedAt, starRole, title',
})
this.version(7).stores({
checkins: '&todoId, date',
lists: 'type',
wayfinderOrder: '&todoId, order, snoozedUntil',
settings: '&key',
starRoles: '@id, title',
starRolesOrder: '&starRoleId, order',
todos: '@id, createdAt, completedAt, starRole, title',
})
this.cloud.configure({
databaseUrl: process.env.NEXT_PUBLIC_DATABASE_URL!,
requireAuth: false,
Expand Down
Loading

0 comments on commit 6f428ba

Please sign in to comment.