Merge branch 'main' of https://github.com/outpoot/rugplay
This commit is contained in:
commit
a027fcfbdf
5 changed files with 35 additions and 18 deletions
|
|
@ -219,7 +219,7 @@
|
||||||
{:else}
|
{:else}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="text-muted-foreground mb-3 text-sm">Sign in to join the discussion</p>
|
<p class="text-muted-foreground mb-3 text-sm">Sign in to join the discussion</p>
|
||||||
<Button onclick={() => goto('/')} size="sm">Sign In</Button>
|
<Button onclick={() => (shouldSignIn = true)} size="sm">Sign In</Button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
import { getPublicUrl, getTimeframeInSeconds, timeToLocal } from '$lib/utils.js';
|
import { getPublicUrl, getTimeframeInSeconds, timeToLocal } from '$lib/utils.js';
|
||||||
import { websocketController, type PriceUpdate, isConnectedStore } from '$lib/stores/websocket';
|
import { websocketController, type PriceUpdate, isConnectedStore } from '$lib/stores/websocket';
|
||||||
import SEO from '$lib/components/self/SEO.svelte';
|
import SEO from '$lib/components/self/SEO.svelte';
|
||||||
|
import SignInConfirmDialog from '$lib/components/self/SignInConfirmDialog.svelte';
|
||||||
|
|
||||||
const { data } = $props();
|
const { data } = $props();
|
||||||
let coinSymbol = $derived(data.coinSymbol);
|
let coinSymbol = $derived(data.coinSymbol);
|
||||||
|
|
@ -39,6 +40,7 @@
|
||||||
let sellModalOpen = $state(false);
|
let sellModalOpen = $state(false);
|
||||||
let selectedTimeframe = $state('1m');
|
let selectedTimeframe = $state('1m');
|
||||||
let lastPriceUpdateTime = 0;
|
let lastPriceUpdateTime = 0;
|
||||||
|
let shouldSignIn = $state(false);
|
||||||
|
|
||||||
let previousCoinSymbol = $state<string | null>(null);
|
let previousCoinSymbol = $state<string | null>(null);
|
||||||
|
|
||||||
|
|
@ -370,6 +372,8 @@
|
||||||
imageAlt={coin ? `${coin.name} (${coin.symbol}) logo` : `${coinSymbol} cryptocurrency logo`}
|
imageAlt={coin ? `${coin.name} (${coin.symbol}) logo` : `${coinSymbol} cryptocurrency logo`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<SignInConfirmDialog bind:open={shouldSignIn} />
|
||||||
|
|
||||||
{#if coin}
|
{#if coin}
|
||||||
<TradeModal bind:open={buyModalOpen} type="BUY" {coin} onSuccess={handleTradeSuccess} />
|
<TradeModal bind:open={buyModalOpen} type="BUY" {coin} onSuccess={handleTradeSuccess} />
|
||||||
<TradeModal
|
<TradeModal
|
||||||
|
|
@ -552,7 +556,7 @@
|
||||||
{:else}
|
{:else}
|
||||||
<div class="py-4 text-center">
|
<div class="py-4 text-center">
|
||||||
<p class="text-muted-foreground mb-3 text-sm">Sign in to start trading</p>
|
<p class="text-muted-foreground mb-3 text-sm">Sign in to start trading</p>
|
||||||
<Button onclick={() => goto('/')}>Sign In</Button>
|
<Button onclick={() => (shouldSignIn = true)}>Sign In</Button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,7 @@
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<div class="text-muted-foreground mb-4 text-xl">Sign in to start gambling</div>
|
<div class="text-muted-foreground mb-4 text-xl">Sign in to start gambling</div>
|
||||||
<p class="text-muted-foreground mb-4 text-sm">You need an account to place bets</p>
|
<p class="text-muted-foreground mb-4 text-sm">You need an account to place bets</p>
|
||||||
<button
|
<Button onclick={() => (shouldSignIn = true)}>Sign In</Button>
|
||||||
class="text-primary underline hover:cursor-pointer"
|
|
||||||
onclick={() => (shouldSignIn = true)}
|
|
||||||
>
|
|
||||||
Sign in to continue
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,14 @@
|
||||||
import { USER_DATA } from '$lib/stores/user-data';
|
import { USER_DATA } from '$lib/stores/user-data';
|
||||||
import { PORTFOLIO_DATA, fetchPortfolioData } from '$lib/stores/portfolio-data';
|
import { PORTFOLIO_DATA, fetchPortfolioData } from '$lib/stores/portfolio-data';
|
||||||
import SendMoneyModal from '$lib/components/self/SendMoneyModal.svelte';
|
import SendMoneyModal from '$lib/components/self/SendMoneyModal.svelte';
|
||||||
|
import SignInConfirmDialog from '$lib/components/self/SignInConfirmDialog.svelte';
|
||||||
|
|
||||||
// TODO: add type definitions
|
// TODO: add type definitions
|
||||||
let transactions = $state<any[]>([]);
|
let transactions = $state<any[]>([]);
|
||||||
let loading = $state(true);
|
let loading = $state(true);
|
||||||
let error = $state<string | null>(null);
|
let error = $state<string | null>(null);
|
||||||
let sendMoneyModalOpen = $state(false);
|
let sendMoneyModalOpen = $state(false);
|
||||||
|
let shouldSignIn = $state(false);
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await Promise.all([loadPortfolioData(), fetchRecentTransactions()]);
|
await Promise.all([loadPortfolioData(), fetchRecentTransactions()]);
|
||||||
|
|
@ -245,6 +247,7 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SendMoneyModal bind:open={sendMoneyModalOpen} onSuccess={handleTransferSuccess} />
|
<SendMoneyModal bind:open={sendMoneyModalOpen} onSuccess={handleTransferSuccess} />
|
||||||
|
<SignInConfirmDialog bind:open={shouldSignIn} />
|
||||||
|
|
||||||
<div class="container mx-auto max-w-7xl p-6">
|
<div class="container mx-auto max-w-7xl p-6">
|
||||||
<div class="mb-6 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center">
|
<div class="mb-6 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center">
|
||||||
|
|
@ -252,12 +255,14 @@
|
||||||
<h1 class="text-3xl font-bold">Portfolio</h1>
|
<h1 class="text-3xl font-bold">Portfolio</h1>
|
||||||
<p class="text-muted-foreground">Manage your investments and transactions</p>
|
<p class="text-muted-foreground">Manage your investments and transactions</p>
|
||||||
</div>
|
</div>
|
||||||
|
{#if $USER_DATA}
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<Button onclick={() => (sendMoneyModalOpen = true)}>
|
<Button onclick={() => (sendMoneyModalOpen = true)}>
|
||||||
<Send class="h-4 w-4" />
|
<Send class="h-4 w-4" />
|
||||||
Send Money
|
Send Money
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if loading}
|
{#if loading}
|
||||||
|
|
@ -268,7 +273,7 @@
|
||||||
<div class="text-muted-foreground mb-4 text-xl">
|
<div class="text-muted-foreground mb-4 text-xl">
|
||||||
You need to be logged in to view your portfolio
|
You need to be logged in to view your portfolio
|
||||||
</div>
|
</div>
|
||||||
<Button onclick={() => goto('/login')}>Log In</Button>
|
<Button onclick={() => (shouldSignIn = true)}>Sign In</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if error}
|
{:else if error}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@
|
||||||
import { USER_DATA } from '$lib/stores/user-data';
|
import { USER_DATA } from '$lib/stores/user-data';
|
||||||
import * as Dialog from '$lib/components/ui/dialog';
|
import * as Dialog from '$lib/components/ui/dialog';
|
||||||
import SEO from '$lib/components/self/SEO.svelte';
|
import SEO from '$lib/components/self/SEO.svelte';
|
||||||
|
import SignInConfirmDialog from '$lib/components/self/SignInConfirmDialog.svelte';
|
||||||
|
|
||||||
|
let shouldSignIn = $state(false);
|
||||||
let name = $state($USER_DATA?.name || '');
|
let name = $state($USER_DATA?.name || '');
|
||||||
let bio = $state($USER_DATA?.bio ?? '');
|
let bio = $state($USER_DATA?.bio ?? '');
|
||||||
let username = $state($USER_DATA?.username || '');
|
let username = $state($USER_DATA?.username || '');
|
||||||
|
|
@ -36,7 +38,7 @@
|
||||||
avatarFile !== undefined
|
avatarFile !== undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
let fileInput: HTMLInputElement;
|
let fileInput: HTMLInputElement | undefined = $state(undefined);
|
||||||
|
|
||||||
let loading = $state(false);
|
let loading = $state(false);
|
||||||
let usernameAvailable: boolean | null = $state(null);
|
let usernameAvailable: boolean | null = $state(null);
|
||||||
|
|
@ -66,7 +68,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleAvatarClick() {
|
function handleAvatarClick() {
|
||||||
fileInput.click();
|
fileInput?.click();
|
||||||
}
|
}
|
||||||
function handleAvatarChange(e: Event) {
|
function handleAvatarChange(e: Event) {
|
||||||
const f = (e.target as HTMLInputElement).files?.[0];
|
const f = (e.target as HTMLInputElement).files?.[0];
|
||||||
|
|
@ -293,6 +295,16 @@
|
||||||
<div class="container mx-auto max-w-2xl p-6">
|
<div class="container mx-auto max-w-2xl p-6">
|
||||||
<h1 class="mb-6 text-2xl font-bold">Settings</h1>
|
<h1 class="mb-6 text-2xl font-bold">Settings</h1>
|
||||||
|
|
||||||
|
{#if !$USER_DATA}
|
||||||
|
<div class="flex h-96 items-center justify-center">
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="text-muted-foreground mb-4 text-xl">
|
||||||
|
You need to be logged in to view your settings
|
||||||
|
</div>
|
||||||
|
<Button onclick={() => (shouldSignIn = true)}>Sign In</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
<div class="space-y-6">
|
<div class="space-y-6">
|
||||||
<Card.Root>
|
<Card.Root>
|
||||||
<Card.Header>
|
<Card.Header>
|
||||||
|
|
@ -476,6 +488,7 @@
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
</Card.Root>
|
</Card.Root>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog.Root bind:open={deleteDialogOpen}>
|
<Dialog.Root bind:open={deleteDialogOpen}>
|
||||||
|
|
|
||||||
Reference in a new issue