Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Release #301

Merged
merged 69 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e1001af
refactor(button): allow overriding button classes
deansallinen Dec 6, 2024
a0918c0
Added robots.txt
aaroncox Dec 6, 2024
cc736a7
Use Big.js to safely wrap asset quantities
aaroncox Dec 6, 2024
281cc49
Link to token page from account balances
aaroncox Dec 6, 2024
41afe8f
refactor: description list component
deansallinen Dec 6, 2024
71ce477
refactor(button): allow overriding button classes
deansallinen Dec 6, 2024
7a361f8
style: actions
deansallinen Dec 6, 2024
09acc18
refactor: use new dl and button styles
deansallinen Dec 6, 2024
24c0855
Balance alignment
aaroncox Dec 8, 2024
052d4a2
Scaffolding initial voter informtion
aaroncox Dec 8, 2024
2c019be
Adding vote weight in token format
aaroncox Dec 9, 2024
bb64e6c
Enabling Votes in advanced mode and other pages in debug mode
aaroncox Dec 9, 2024
e845ffd
Merge pull request #299 from greymass/voter
aaroncox Dec 9, 2024
5f23ace
Merge pull request #300 from greymass/tokens
aaroncox Dec 9, 2024
5a2ee4e
Merge pull request #297 from greymass/refactor-dl
aaroncox Dec 9, 2024
0801f3a
Merge pull request #296 from greymass/robots
aaroncox Dec 9, 2024
950ec8b
Merge pull request #295 from greymass/overridable-buttons
aaroncox Dec 9, 2024
e397872
Merge pull request #298 from greymass/msig
aaroncox Dec 9, 2024
bb0bfc6
fix: layout of key page
deansallinen Dec 10, 2024
4c7f2a1
Merge pull request #303 from greymass/fix-key-layout
aaroncox Dec 10, 2024
79594fc
Moved all state to manager and added debugging
aaroncox Dec 10, 2024
a97fed9
Refactored state for approvals/participants
aaroncox Dec 10, 2024
3cdf9bb
Disable success toast
aaroncox Dec 10, 2024
4519bfa
Use contexts transacting state
aaroncox Dec 10, 2024
6cb3298
Removed unused error (should be in Wharf context?)
aaroncox Dec 10, 2024
4415f78
Removed unused `changed` state
aaroncox Dec 10, 2024
64352fe
Removed try/catch, was causing further code to execute
aaroncox Dec 10, 2024
31545d5
Removed unneeded transact method
aaroncox Dec 10, 2024
7d5f058
Reworked constructor to prevent needing undefined for state
aaroncox Dec 10, 2024
50d40fe
Implement ABICache in NetworkState
aaroncox Dec 10, 2024
a47ea6f
Moved decoding to manager and allow overriding on setabi calls
aaroncox Dec 10, 2024
aa89cb9
removed logging
aaroncox Dec 10, 2024
84ae0e7
Adding cleos support while in advanced mode
aaroncox Dec 11, 2024
ff742f4
Merge pull request #305 from greymass/cleos
aaroncox Dec 11, 2024
f50984f
Add a few helper API methods to retrieve producers
aaroncox Dec 11, 2024
65cb896
Added Top21/BP checks to msig page
aaroncox Dec 11, 2024
bdda2ce
Simplified API calls
aaroncox Dec 11, 2024
bc00ac3
Linting
aaroncox Dec 11, 2024
0994cc1
Removed unneeded ORIGIN
aaroncox Dec 11, 2024
79dd0f6
Removed logging
aaroncox Dec 12, 2024
ebfb505
Merge pull request #304 from greymass/msig
aaroncox Dec 12, 2024
dacf52a
Added supply, marketcap, and data for homepage
aaroncox Dec 10, 2024
cb0f3f1
Conditionally adding homepage sections when in debug mode
aaroncox Dec 10, 2024
42a74ff
Adding manually defined redirects from v1 to v2
aaroncox Dec 10, 2024
f621dca
Linting
aaroncox Dec 12, 2024
b72c7fe
Formatting
aaroncox Dec 12, 2024
4208f29
Linting
aaroncox Dec 12, 2024
0f7885a
Added additional price metrics
aaroncox Dec 12, 2024
dbaa25f
Homepage + funding content
aaroncox Dec 12, 2024
16ced4b
Fixed issue with missing voter_info
aaroncox Dec 13, 2024
cb284ed
Updating wharfkit/account
aaroncox Dec 13, 2024
c732bca
feat: permission tree page
deansallinen Dec 11, 2024
a51e3d9
style: add permission tree decoration
deansallinen Dec 12, 2024
9234fa6
feat: include accounts in required auth
deansallinen Dec 12, 2024
51f21d2
feat: linked actions
deansallinen Dec 12, 2024
18ec58b
fix: action link
deansallinen Dec 13, 2024
7fceff4
Merge pull request #302 from greymass/homepage
aaroncox Dec 13, 2024
c51bc63
feat: relative time in wait
deansallinen Dec 13, 2024
737e9b8
fix: action display
deansallinen Dec 13, 2024
d3a907b
fix: permission mobile view
deansallinen Dec 13, 2024
771f81e
refactor: handle empty required_auth
deansallinen Dec 13, 2024
5913d6b
fix: key icon centering
deansallinen Dec 13, 2024
24338fa
fix: copy button size
deansallinen Dec 13, 2024
0b8cb41
style: less hot wait text color
deansallinen Dec 13, 2024
b90097c
fix: indentation bug
deansallinen Dec 13, 2024
74397a4
chore: remove logging
deansallinen Dec 13, 2024
d6b979e
refactor: single dayjs setup
deansallinen Dec 13, 2024
24cc9c1
Merge pull request #307 from greymass/permissions-page
aaroncox Dec 14, 2024
82b9dbb
Allow attempting claim if date is not set
aaroncox Dec 14, 2024
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
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@coinbase/cbpay-js": "^2.4.0",
"@fontsource/jetbrains-mono": "^5.1.0",
"@tailwindcss/container-queries": "^0.1.1",
"@wharfkit/account": "^1.2.0",
"@wharfkit/account": "^1.3.0",
"@wharfkit/account-creation-plugin-greymass": "^1.2.0",
"@wharfkit/account-creation-plugin-metamask": "^1.1.1",
"@wharfkit/antelope": "^1.0.11",
Expand All @@ -63,6 +63,7 @@
"@wharfkit/session": "^1.4.0",
"@wharfkit/transact-plugin-resource-provider": "^1.1.1",
"@wharfkit/wallet-plugin-anchor": "^1.4.0",
"@wharfkit/wallet-plugin-cleos": "^1.2.0",
"@wharfkit/wallet-plugin-metamask": "^1.1.1",
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
"@wharfkit/wallet-plugin-scatter": "^1.5.1",
Expand Down
23 changes: 22 additions & 1 deletion src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ function isNetwork(value: string) {
return isNetworkShortName(value);
}

const redirects: Record<string, string> = {
'/earn': '/staking',
'/resources/ram/buy': '/ram/buy',
'/resources/ram/sell': '/ram/sell'
};

function getManualRedirectPath(pathMore: string[]): string {
const pathname = '/' + pathMore.join('/');
return redirects[pathname];
}

function isManualRedirectPath(pathMore: string[]): boolean {
const pathname = '/' + pathMore.join('/');
return pathname in redirects;
}

export async function redirectHandle({ event, resolve }: HandleParams): Promise<Response> {
const { pathname, search } = new URL(event.request.url);

Expand Down Expand Up @@ -79,10 +95,15 @@ export async function redirectHandle({ event, resolve }: HandleParams): Promise<
url += `/${network}`;
}
if (pathMore.length > 0) {
url += `/${pathMore.join('/')}`;
if (isManualRedirectPath(pathMore)) {
url += getManualRedirectPath(pathMore);
} else {
url += `/${pathMore.join('/')}`;
}
}

if (pathname !== url) {
console.log('redirecting to', url + search);
return new Response(undefined, {
headers: { Location: url + search },
status: 301
Expand Down
42 changes: 20 additions & 22 deletions src/lib/components/button/button.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { cn } from '$lib/utils';
import { emptyMeltElement, melt, type AnyMeltElement } from '@melt-ui/svelte';
import type { Snippet } from 'svelte';
import type { HTMLButtonAttributes, HTMLLinkAttributes } from 'svelte/elements';
Expand All @@ -7,7 +8,7 @@

interface ButtonProps extends HTMLAttributes {
href?: string;
variant?: 'primary' | 'secondary' | 'pill' | 'outline';
variant?: 'primary' | 'secondary' | 'pill';
disabled?: boolean;
active?: boolean;
blank?: boolean;
Expand All @@ -22,6 +23,7 @@
onclick,
variant = 'primary',
active,
class: className,
disabled = false,
...props
}: ButtonProps = $props();
Expand All @@ -41,37 +43,33 @@
}
: {}
);

const primaryStyles =
'relative inline-flex h-12 grow items-center justify-center text-nowrap rounded-lg bg-skyBlue-700 px-8 text-center text-base font-medium text-skyBlue-50 transition-all focus:outline-transparent focus-visible:outline focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-solar-500 hover:active:bg-skyBlue-800 disabled:cursor-not-allowed disabled:bg-mineShaft-900 disabled:text-white/60 disabled:opacity-30 disabled:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:bg-skyBlue-600';

const secondaryStyles =
'relative flex h-12 grow items-center justify-center text-nowrap rounded-lg px-8 text-center text-base font-medium text-skyBlue-400 ring-2 ring-inset ring-mineShaft-600 transition-all hover:ring-transparent focus-visible:outline-none focus-visible:ring-solar-500 hover:active:bg-mineShaft-950 hover:active:ring-mineShaft-900 disabled:cursor-not-allowed disabled:text-mineShaft-400 disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:ring-mineShaft-600 disabled:active:ring-mineShaft-600 [@media(any-hover:hover)]:hover:bg-mineShaft-900';

const pillStyles =
'relative inline-flex h-10 items-center justify-center text-nowrap rounded-full border-2 border-transparent px-5 text-center text-base font-medium leading-4 transition-all focus-visible:outline focus-visible:outline-2 focus-visible:outline-solar-500 hover:active:bg-mineShaft-950 aria-[current]:border-mineShaft-200/30 [@media(any-hover:hover)]:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:text-mineShaft-100';

let styles = {
primary: primaryStyles,
secondary: secondaryStyles,
pill: pillStyles
};
</script>

<svelte:element
this={tag}
use:melt={$meltElement}
data-variant={variant}
class={props.class || ''}
class={cn(styles[variant], className)}
role={ariaRole}
aria-current={ariaCurrent}
{disabled}
{onclick}
{...props}
{...linkProps}
>
<span>{@render props.children()}</span>
<span class="pointer-events-none relative text-inherit">{@render props.children()}</span>
</svelte:element>

<style lang="postcss">
[data-variant='primary'] {
@apply relative inline-flex h-12 grow items-center justify-center text-nowrap rounded-lg bg-skyBlue-700 px-8 text-center text-base font-medium text-skyBlue-50 transition-all focus:outline-transparent focus-visible:outline focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-solar-500 hover:active:bg-skyBlue-800 disabled:cursor-not-allowed disabled:bg-mineShaft-900 disabled:text-white/60 disabled:opacity-30 disabled:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:bg-skyBlue-600;
}

[data-variant='secondary'] {
@apply relative flex h-12 grow items-center justify-center text-nowrap rounded-lg px-8 text-center text-base font-medium text-skyBlue-400 ring-2 ring-inset ring-mineShaft-600 transition-all hover:ring-transparent focus-visible:outline-none focus-visible:ring-solar-500 hover:active:bg-mineShaft-950 hover:active:ring-mineShaft-900 disabled:cursor-not-allowed disabled:text-mineShaft-400 disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:ring-mineShaft-600 disabled:active:ring-mineShaft-600 [@media(any-hover:hover)]:hover:bg-mineShaft-900;
}

[data-variant='pill'] {
@apply relative inline-flex h-10 items-center justify-center text-nowrap rounded-full border-2 border-transparent px-5 text-center text-base font-medium leading-4 transition-all focus-visible:outline focus-visible:outline-2 focus-visible:outline-solar-500 hover:active:bg-mineShaft-950 aria-[current]:border-mineShaft-200/30 [@media(any-hover:hover)]:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:text-mineShaft-100;
}

span {
@apply pointer-events-none relative text-inherit;
}
</style>
11 changes: 9 additions & 2 deletions src/lib/components/button/copy.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
import { browser } from '$app/environment';
import type { UnicoveContext } from '$lib/state/client.svelte';
import { getContext } from 'svelte';
import { cn } from '$lib/utils';

const context = getContext<UnicoveContext>('state');

interface Props {
data: string;
slop?: boolean;
}

let props: Props = $props();
let { slop = true, ...props }: Props = $props();

let hint = $state(false);

Expand All @@ -26,6 +28,8 @@
if (context.settings.data.debugMode) console.error('Failed to copy text: ', err);
}
}

let buttonSize = $derived(slop ? 'size-12' : 'size-4');
</script>

<!-- Styled as a trailing element. Will need to change it if we want to use it inline with other elements following it. -->
Expand All @@ -35,7 +39,10 @@
>
<button
onclick={copyToClipboard}
class="peer absolute left-1/2 top-1/2 size-12 -translate-x-1/2 -translate-y-1/2 focus-visible:outline-none"
class={cn(
'peer absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 focus-visible:outline-none',
buttonSize
)}
aria-label="Copy"
>
<!-- Button is done this way with absolute positioning so we can maintain a decent hit slop on mobile without affecting layout -->
Expand Down
25 changes: 0 additions & 25 deletions src/lib/components/descriptionlist.svelte

This file was deleted.

5 changes: 5 additions & 0 deletions src/lib/components/descriptionlist/dd.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
let props = $props();
</script>

<dd class="grow text-balance break-all text-right tabular-nums">{@render props.children()}</dd>
10 changes: 4 additions & 6 deletions src/lib/components/descriptionlist/dl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import Dlrow from './dlrow.svelte';

type DescriptionItem = {
key: string;
value: string;
title: string;
description: string;
};

interface Props {
Expand All @@ -17,10 +17,8 @@

<dl class="@container">
{#if props.items}
{#each props.items as item}
<Dlrow title={item.key}>
{item.value}
</Dlrow>
{#each props.items as { title, description }}
<Dlrow {title} {description} />
{/each}
{:else if props.children}
{@render props.children()}
Expand Down
21 changes: 17 additions & 4 deletions src/lib/components/descriptionlist/dlrow.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import DT from './dt.svelte';
import DD from './dd.svelte';

interface Props {
title: string;
children: Snippet;
description?: string;
children?: Snippet;
}
let { title, children }: Props = $props();

let { title = '', description, children }: Props = $props();
</script>

<div
class="flex flex-wrap items-center justify-between gap-x-4 border-b border-mineShaft-900 py-3 last:border-none @xs:flex-nowrap"
>
<dt class="caption self-start text-nowrap">{title}</dt>
<dd class="grow text-balance break-all text-right tabular-nums">{@render children()}</dd>
<DT>{title}</DT>
<div
class="grow bg-red-500 before:content-['ERROR_Missing_DD_element_'] has-[dd]:bg-transparent has-[dd]:before:hidden"
>
{#if description}
<DD>{description}</DD>
{/if}
{#if children}
{@render children()}
{/if}
</div>
</div>
5 changes: 5 additions & 0 deletions src/lib/components/descriptionlist/dt.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
let props = $props();
</script>

<dt class="caption self-start text-nowrap">{@render props.children()}</dt>
2 changes: 2 additions & 0 deletions src/lib/components/descriptionlist/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { default as DL } from './dl.svelte';
export { default as DLRow } from './dlrow.svelte';
export { default as DD } from './dd.svelte';
export { default as DT } from './dt.svelte';
8 changes: 6 additions & 2 deletions src/lib/components/elements/account.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { HTMLAnchorAttributes } from 'svelte/elements';
import { createLinkPreview, melt, type CreateLinkPreviewProps } from '@melt-ui/svelte';
import { fly } from 'svelte/transition';
import { User } from 'lucide-svelte';
import { User, UserIcon } from 'lucide-svelte';
import { Name } from '@wharfkit/antelope';
import type { UnicoveContext } from '$lib/state/client.svelte';
import { AccountState } from '$lib/state/client/account.svelte';
Expand All @@ -15,6 +15,7 @@
contract?: boolean;
children?: Snippet;
preview?: boolean;
icon?: boolean;
}

let { name, contract = false, preview = false, children, ...props }: Props = $props();
Expand Down Expand Up @@ -51,11 +52,14 @@
<a
href={path}
class={cn(
'text-skyBlue-500 hover:text-skyBlue-400 focus-visible:outline focus-visible:outline-solar-500 ',
'inline-flex items-center gap-2 text-skyBlue-500 hover:text-skyBlue-400 focus-visible:outline focus-visible:outline-solar-500 ',
props.class
)}
use:melt={$trigger}
>
{#if props.icon}
<UserIcon class="size-4" />
{/if}
{#if children}
{@render children()}
{:else}
Expand Down
34 changes: 30 additions & 4 deletions src/lib/components/elements/action.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
<script lang="ts">
import { type Action } from '@wharfkit/antelope';
import Code from '../code.svelte';
import { DL, DLRow, DD } from '../descriptionlist';
import { Stack } from '../layout';
import Account from './account.svelte';

interface Props {
data: Record<string, unknown>;
action: Action;
}

let props: Props = $props();
let { action }: Props = $props();

// const arr = action.authorization.map((auth) => [Account, auth]);
// let test = [Account];
</script>

{#if props.data}
<Code>{JSON.stringify(props.data, null, 2)}</Code>
{#if action}
<div class="grid grid-cols-2 items-start gap-6">
<Code>{JSON.stringify(action.data, null, 2)}</Code>
<Stack class="gap-2">
<h3 class="h4">{String(action.name)}</h3>
<DL>
<DLRow title="Contract">
<DD>
<Account name={action.account} contract />
</DD>
</DLRow>
<DLRow title="Authorization">
{#each action.authorization as auth}
<DD>
<Account name={auth.actor}>{auth}</Account>
</DD>
{/each}
</DLRow>
</DL>
</Stack>
</div>
{/if}
Loading
Loading