generated from prokawsar/dashboard-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/prokawsar/paper-calc
- Loading branch information
Showing
20 changed files
with
402 additions
and
141 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
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,4 @@ | ||
import { PUBLIC_SUPABASE_ANON, PUBLIC_SUPABASE_URL } from '$env/static/public' | ||
import { createClient } from '@supabase/supabase-js' | ||
|
||
export const supabase = createClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON) |
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,30 +1,37 @@ | ||
<script lang="ts"> | ||
import { focusedInputStore } from '$lib/stores' | ||
import { makeid } from '$lib/utils/tools' | ||
import { onMount } from 'svelte' | ||
export let id: string = makeid(3) | ||
export let value: string | ||
export let placeholder: string = '' | ||
export let type: string = 'number' | ||
export let disabled: boolean = false | ||
export let classNames: string = '' | ||
let inputRef: HTMLInputElement | ||
onMount(() => { | ||
if (inputRef) { | ||
inputRef.type = type | ||
} | ||
}) | ||
</script> | ||
|
||
<input | ||
bind:this={inputRef} | ||
{id} | ||
{disabled} | ||
class="input-field focus:!border-[1.5px] focus:!border-teal-500 focus:outline-none" | ||
type="number" | ||
{placeholder} | ||
class="input-field focus:!border-[1.5px] focus:!border-teal-500 focus:outline-none {classNames}" | ||
bind:value | ||
on:keydown | ||
on:focus | ||
on:focus={() => ($focusedInputStore = inputRef)} | ||
{...$$restProps} | ||
/> | ||
|
||
<style lang="postcss"> | ||
.input-field { | ||
@apply border border-gray-400 w-14 p-1 rounded; | ||
@apply border border-gray-400 w-12 p-1 rounded; | ||
} | ||
</style> |
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,6 @@ | ||
<script lang="ts"> | ||
import Icon from '@iconify/svelte' | ||
</script> | ||
|
||
<!-- <Icon icon="svg-spinners:wind-toy" width="36px" /> --> | ||
<Icon icon="ei:spinner-3" width="44px" class="animate-spin" /> |
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,16 +1,4 @@ | ||
import type { Paper } from '$lib/utils/services' | ||
import { persisted } from 'svelte-persisted-store' | ||
import { writable, type Writable } from 'svelte/store' | ||
|
||
export type PaperHistory = { | ||
id: string | ||
finalPrice: number | ||
date?: Date | ||
papers: Paper[] | ||
} | ||
function getPaperStore(): Writable<{ history: PaperHistory[] }> { | ||
return persisted<{ history: PaperHistory[] }>('paper_cost_history', { history: [] }) | ||
} | ||
|
||
export const paperHistoryStore = getPaperStore() | ||
export const focusedInputStore: Writable<HTMLInputElement | null> = writable(null) | ||
export const totalHistoryStore: Writable<number> = writable(0) |
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,49 @@ | ||
<script lang="ts"> | ||
import { page } from '$app/stores' | ||
import { PUBLIC_MIX_TOKEN } from '$env/static/public' | ||
import '$lib/app.css' | ||
import '@fontsource/jost' | ||
import { navigating } from '$app/stores' | ||
import Loader from '$lib/elements/Loader.svelte' | ||
import mixpanel from 'mixpanel-browser' | ||
//Import Mixpanel SDK | ||
mixpanel.init(PUBLIC_MIX_TOKEN, { | ||
debug: false, | ||
track_pageview: true, | ||
persistence: 'localStorage' | ||
}) | ||
</script> | ||
|
||
<main class="h-[100svh] flex flex-col"> | ||
{#if $navigating} | ||
<div | ||
class="absolute bg-white bg-opacity-80 flex h-full w-full items-center justify-center z-10" | ||
> | ||
<Loader /> | ||
</div> | ||
{/if} | ||
<nav> | ||
<div class="flex justify-center py-2"> | ||
<p class="text-center text-2xl text-red-600 font-semibold">Molla Printing & Packaging</p> | ||
</div> | ||
<div | ||
class="w-full max-w-6xl mx-auto bg-gradient-to-r from-transparent via-orange-800/40 to-transparent p-[1px]" | ||
/> | ||
<div class="px-4 flex w-full mt-2"> | ||
<div class="flex w-full flex-row justify-end gap-3 py-1 px-2 rounded border border-teal-400"> | ||
<a href="/history" class:hidden={$page.url.pathname == '/history'} class="h-full">History</a | ||
> | ||
<a href="/" class:!block={$page.url.pathname == '/history'} class="hidden h-full">Home</a> | ||
</div> | ||
</div> | ||
</nav> | ||
<slot /> | ||
|
||
<div class="absolute bottom-0 w-full"> | ||
<p class="text-center text-gray-400"> | ||
💻Developed by <a href="https://github.com/prokawsar" target="_blank">ProKawsar</a | ||
>😎 | ||
</p> | ||
</div> | ||
</main> |
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,8 @@ | ||
import { supabase } from '$lib/db/supabaseClient' | ||
|
||
export async function load() { | ||
const { data } = await supabase.from('history').select() | ||
return { | ||
histories: data ?? [] | ||
} | ||
} |
Oops, something went wrong.