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

fix(devwallet): small styling fixes #2654

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .changeset/nervous-shoes-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
11 changes: 11 additions & 0 deletions packages/apps/dev-wallet/src/App/Layout/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
MonoDarkMode,
MonoKey,
MonoLightMode,
MonoLogout,
MonoNetworkCheck,
MonoSignature,
MonoSwapHoriz,
Expand All @@ -14,6 +15,7 @@ import {

import { NetworkSelector } from '@/Components/NetworkSelector/NetworkSelector';

import { useWallet } from '@/modules/wallet/wallet.hook';
import { Button, Themes, useTheme } from '@kadena/kode-ui';
import {
SideBarItem,
Expand All @@ -28,6 +30,7 @@ import { KLogo } from './KLogo';
export const SideBar: FC = () => {
const { theme, setTheme } = useTheme();
const { isExpanded } = useLayout();
const { lockProfile } = useWallet();

const toggleTheme = (): void => {
const newTheme = theme === Themes.dark ? Themes.light : Themes.dark;
Expand Down Expand Up @@ -105,6 +108,14 @@ export const SideBar: FC = () => {
context={
<>
<SideBarItemsInline>
<SideBarItem visual={<MonoLogout />} label="Logout">
<Button
isCompact
variant="transparent"
onPress={lockProfile}
startVisual={<MonoLogout />}
/>
</SideBarItem>
<SideBarItem
visual={<MonoContrast />}
onPress={toggleTheme}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { atoms } from '@kadena/kode-ui/styles';
import { style } from '@vanilla-extract/css';

export const authCard = style([
atoms({
padding: 'xxl',
}),
{
width: '100%',
borderRadius: '1px',
textAlign: 'left',
backgroundColor: 'rgba(255, 255, 255, 0.03)',
Expand Down
26 changes: 21 additions & 5 deletions packages/apps/dev-wallet/src/pages/account/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { linkClass } from '../transfer/style.css';
import { ActivityTable } from './Components/ActivityTable';
import { AliasForm } from './Components/AliasForm';
import { Redistribute } from './Components/Redistribute';
import { addressBreakClass } from './style.css';

export function AccountPage() {
const { accountId } = useParams();
Expand Down Expand Up @@ -116,7 +117,9 @@ export function AccountPage() {
</Stack>

<Stack justifyContent={'space-between'}>
<Heading variant="h5">{account.address}</Heading>
<Heading variant="h5" className={addressBreakClass}>
{account.address}
</Heading>
</Stack>

<Stack flexDirection={'row'} gap="sm" alignItems={'center'}>
Expand Down Expand Up @@ -167,7 +170,7 @@ export function AccountPage() {
)}
<Tabs>
<TabItem key="guard" title="Details">
<Stack gap="lg">
<Stack gap="lg" width="100%">
<QRCode
ecLevel="L"
size={150}
Expand All @@ -185,11 +188,19 @@ export function AccountPage() {
>
<Stack flexDirection={'column'} gap={'sm'}>
<Text>Contract</Text>
<Text color="emphasize" variant="code">
<Text
color="emphasize"
variant="code"
className={addressBreakClass}
>
{account.contract}
</Text>
</Stack>
<Stack flexDirection={'column'} gap={'sm'}>
<Stack
flexDirection={'column'}
gap={'sm'}
className={addressBreakClass}
>
<Text>Address</Text>
<Text color="emphasize" variant="code">
{account.address}
Expand All @@ -204,7 +215,12 @@ export function AccountPage() {
<Stack flexDirection={'column'} gap={'sm'}>
<Text>Keys</Text>
{keyset.guard.keys.map((key) => (
<Stack key={key} gap="sm" alignItems={'center'}>
<Stack
key={key}
gap="sm"
alignItems={'center'}
className={addressBreakClass}
>
<Text>
<MonoKey />
</Text>
Expand Down
5 changes: 5 additions & 0 deletions packages/apps/dev-wallet/src/pages/account/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ export const listItemClass = style([
},
},
]);

export const addressBreakClass = style({
width: '90%',
wordBreak: 'break-all',
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useWallet } from '@/modules/wallet/wallet.hook';
import { Button, Heading, Stack } from '@kadena/kode-ui';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { createSelectionOptions } from './createSelectionOptions';
import { createProfileFromChainweaverData } from './createProfileFromChainweaverData';
import { createSelectionOptions } from './createSelectionOptions';

type Inputs = {
password?: string;
Expand Down Expand Up @@ -156,8 +156,11 @@ export const ImportChainweaverExport: React.FC = () => {
return (
<>
{step === 'upload' && (
<form onSubmit={handleSubmit(parseAndCreateSelectionOptions)}>
<Stack flexDirection="column">
<form
onSubmit={handleSubmit(parseAndCreateSelectionOptions)}
style={{ width: '100%' }}
>
<Stack flexDirection="column" width="100%" gap="md">
<label htmlFor="chainweaverFile">
Upload the exported file from Chainweaver
</label>
Expand All @@ -172,9 +175,12 @@ export const ImportChainweaverExport: React.FC = () => {
)}

{step === 'select' && (
<form onSubmit={handleSubmit(importSelection)}>
<form
onSubmit={handleSubmit(importSelection)}
style={{ width: '100%' }}
>
<Button type="submit">Import</Button>
<Stack flexDirection="column">
<Stack flexDirection="column" width="100%">
{Object.keys(selectionOptions).map((key) => {
const value =
selectionOptions[key as keyof typeof selectionOptions];
Expand Down Expand Up @@ -232,8 +238,11 @@ export const ImportChainweaverExport: React.FC = () => {
)}

{step === 'password' && (
<form onSubmit={handleSubmit(importSelection)}>
<Stack flexDirection="column">
<form
onSubmit={handleSubmit(importSelection)}
style={{ width: '100%' }}
>
<Stack flexDirection="column" width="100%">
<label htmlFor="profileName">Enter your Profile Name</label>
<input type="profileName" {...register('profileName')} />
<label htmlFor="password">Enter your password</label>
Expand Down
6 changes: 3 additions & 3 deletions packages/apps/dev-wallet/src/pages/keys/Components/Keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ export function Keys() {
justifyContent={'space-between'}
alignItems={'center'}
>
<Stack gap={'lg'}>
<Text> Index: {key.index}</Text>
<Text>{shorten(key.publicKey, 35)}</Text>
<Stack gap={'md'}>
<Text> Idx: {key.index}</Text>
<Text>{shorten(key.publicKey, 20)}</Text>
</Stack>
<ContextMenu
placement="bottom end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function SelectProfile() {
const redirect = params.get('redirect');

return (
<Box>
<Box width="100%">
<Heading variant="h1" className={titleClass}>
Welcome to <br /> Chainweaver v3.0
</Heading>
Expand All @@ -58,6 +58,7 @@ export function SelectProfile() {
gap="sm"
flexWrap="wrap"
marginBlock="lg"
width="100%"
>
{profileList.map((profile) =>
profile.options.authMode === 'WEB_AUTHN' ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export function TransferForm({
/>
)}

<Stack flexDirection="column" gap="md" flex={1}>
<Stack flexDirection="column" gap="md" flex={1} width="100%">
<Stack gap="sm" flexDirection={'column'}>
<Heading variant="h2">Transfer</Heading>
</Stack>
Expand Down Expand Up @@ -963,6 +963,7 @@ export function TransferForm({
flexDirection={'column'}
className={panelClass}
paddingBlockEnd={'xxl'}
width="100%"
>
<AdvancedMode>
<Stack marginBlockStart={'md'} marginBlockEnd={'sm'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export function TransferV2() {
Transfer
</SideBarBreadcrumbsItem>
</SideBarBreadcrumbs>
<Stack flexDirection={'column'}>
<Stack flexDirection={'column'} width="100%">
<Stepper direction="horizontal">
<Step
icon={<MonoSwapHoriz />}
Expand All @@ -282,7 +282,7 @@ export function TransferV2() {
<Stack
gap={'lg'}
flexDirection={'column'}
style={{ width: '670px' }}
style={{ maxWidth: '670px', width: '100%' }}
>
<TransferForm
accountId={accountId}
Expand Down
7 changes: 0 additions & 7 deletions packages/apps/dev-wallet/src/pages/transfer/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,6 @@ export function Transfer() {
transferAll,
]);

console.log({
receiverAccount,
discoveredReceivers,
isValid,
optimalTransfers,
});

return (
<>
{!receiverAccount && discoveredReceivers.length > 1 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ export const itemClass = style([
display: 'flex',
padding: 0,
whiteSpace: 'nowrap',
marginInlineEnd: token('spacing.sm'),
selectors: {
'&:not(:first-child):not(:last-child)::before': {
content: '/',
color: token('color.text.gray.default'),
marginInline: token('spacing.sm'),
marginInlineEnd: token('spacing.sm'),
},
'&:not(:first-child):last-child::before': {
content: '/',
color: token('color.text.gray.default'),
marginInline: token('spacing.sm'),
marginInlineEnd: token('spacing.sm'),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ export const Primary: IStory = {
<SideBarBreadcrumbsItem href="/accounts/2">
Skeletor
</SideBarBreadcrumbsItem>
<SideBarBreadcrumbsItem href="/accounts/2">
Cringer
</SideBarBreadcrumbsItem>
<SideBarBreadcrumbsItem href="/accounts/2">
Orko
</SideBarBreadcrumbsItem>
<SideBarBreadcrumbsItem href="/accounts/2">
Masters of the Universe
</SideBarBreadcrumbsItem>
</SideBarBreadcrumbs>
<InnerLayout />
</LayoutProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SideBarBreadcrumbs: FC<IBreadcrumbsProps> = ({

return createPortal(
<Breadcrumbs {...props}>{children}</Breadcrumbs>,

breadcrumbsRef,
);
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { atoms, globalStyle, style } from './../../../../styles';
import { atoms, globalStyle, style, token } from './../../../../styles';

export const rightAsideClass = style([
atoms({ display: 'flex', flexDirection: 'column', flex: 1 }),
{},
]);
export const rightAsideContentClass = style([
atoms({ flex: 1, display: 'flex', flexDirection: 'column', width: '100%' }),
{},
atoms({
flex: 1,
display: 'flex',
flexDirection: 'column',
width: '100%',
}),
{ paddingInline: token('spacing.md') },
]);

globalStyle(`${rightAsideClass} > form `, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { FC, PropsWithChildren, ReactElement } from 'react';
import React, { useEffect, useRef } from 'react';
import type { PressEvent } from 'react-aria';
import {
crumbsWrapperClass,
headerClass,
headerExpandedClass,
headerWrapperClass,
Expand Down Expand Up @@ -60,7 +61,7 @@ export const SideBarHeader: FC<IProps> = ({ minifiedLogo }) => {
/>
</Stack>
</Media>
<Stack ref={ref} style={{ gridArea: 'header-crumbs' }}></Stack>
<Stack className={crumbsWrapperClass} ref={ref}></Stack>
</Stack>
</header>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const SideBarItem: FC<ISideBarItemProps> = ({
const LinkWrapper = component ? component : Anchor;
return (
<LinkWrapper
onPress={handleLinkClick}
aria-label={label}
data-isactive={isActiveUrl(href)}
className={sidebartreeItemClass({
Expand All @@ -67,7 +66,7 @@ export const SideBarItem: FC<ISideBarItemProps> = ({
if (children) return children;

return (
<li className={listItemClass}>
<li className={listItemClass} onClick={handleLinkClick}>
<Media lessThan="md" style={{ flex: 1, display: 'flex' }}>
{render(true)}
</Media>
Expand Down
17 changes: 17 additions & 0 deletions packages/libs/kode-ui/src/patterns/SideBarLayout/sidebar.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,23 @@ export const headerClass = style([
}),
]);

export const crumbsWrapperClass = style([
{
gridArea: 'header-crumbs',
},
]);

globalStyle(`${crumbsWrapperClass} > *`, {
...responsiveStyle({
xs: {
display: 'none!important',
},
sm: {
display: 'flex!important',
},
}),
});

export const headerExpandedClass = style([
responsiveStyle({
md: { paddingInlineStart: '50px' },
Expand Down
Loading