create-near-app 6.0.0-beta.2 → 6.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +6 -11
- package/dist/make.js +44 -81
- package/dist/messages.js +31 -23
- package/dist/package-json.js +16 -16
- package/dist/tracking.js +1 -1
- package/dist/types.js +5 -4
- package/dist/user-input.js +81 -89
- package/package.json +1 -1
- package/templates/contracts/{rust → rs}/Cargo.toml +0 -3
- package/templates/contracts/{rust → rs}/README.md +14 -5
- package/templates/contracts/rs/build.sh +3 -0
- package/templates/contracts/rs/deploy.sh +2 -0
- package/templates/contracts/{rust → rs}/src/lib.rs +4 -6
- package/templates/contracts/rs/test-rs.sh +9 -0
- package/templates/contracts/rs/test-ts.sh +10 -0
- package/templates/contracts/{js → ts}/README.md +1 -0
- package/templates/contracts/ts/package.json +20 -0
- package/templates/frontend/next/.eslintrc.json +3 -0
- package/templates/frontend/next/README.md +36 -0
- package/templates/frontend/next/jsconfig.json +7 -0
- package/templates/frontend/next/next.config.js +6 -0
- package/templates/frontend/next/package.json +40 -0
- package/templates/frontend/next/public/near-logo.svg +43 -0
- package/templates/frontend/next/public/near.svg +1 -0
- package/templates/frontend/next/src/app/app.module.css +228 -0
- package/templates/frontend/next/src/app/globals.css +95 -0
- package/templates/frontend/next/src/app/hello-components/page.js +44 -0
- package/templates/frontend/next/src/app/hello-near/page.js +64 -0
- package/templates/frontend/next/src/app/layout.js +22 -0
- package/templates/frontend/next/src/app/page.js +37 -0
- package/templates/frontend/next/src/components/cards.js +46 -0
- package/templates/frontend/next/src/components/navigation.js +36 -0
- package/templates/frontend/next/src/components/vm-component.js +26 -0
- package/templates/frontend/next/src/config.js +21 -0
- package/templates/frontend/next/src/wallets/wallet-selector.js +128 -0
- package/templates/frontend/{gateway/src/data/web3.ts → next/src/wallets/web3-wallet.ts} +4 -7
- package/templates/frontend/vanilla/.babelrc +7 -0
- package/templates/frontend/vanilla/package.json +27 -13
- package/templates/frontend/vanilla/{assets → src/assets}/global.css +25 -56
- package/templates/frontend/vanilla/src/components.html +61 -0
- package/templates/frontend/vanilla/src/components.js +63 -0
- package/templates/frontend/vanilla/src/hello-near.html +80 -0
- package/templates/frontend/vanilla/src/hello.js +61 -0
- package/templates/frontend/vanilla/src/index.html +65 -0
- package/templates/frontend/vanilla/{near-wallet.js → src/near-wallet.js} +20 -18
- package/templates/frontend/vanilla/webpack.config.js +79 -0
- package/templates/{integration-tests/rust-tests → sandbox-tests/sandbox-rs}/Cargo.toml +5 -5
- package/templates/{integration-tests/js-tests → sandbox-tests/sandbox-ts}/package.json +6 -6
- package/templates/contracts/js/build.sh +0 -5
- package/templates/contracts/js/deploy.sh +0 -18
- package/templates/contracts/js/package.json +0 -19
- package/templates/contracts/rust/build.sh +0 -6
- package/templates/contracts/rust/deploy.sh +0 -18
- package/templates/frontend/gateway/.env +0 -1
- package/templates/frontend/gateway/.nvmrc +0 -1
- package/templates/frontend/gateway/.prettierrc +0 -6
- package/templates/frontend/gateway/next.config.js +0 -15
- package/templates/frontend/gateway/package.json +0 -74
- package/templates/frontend/gateway/public/apple-touch-icon.png +0 -0
- package/templates/frontend/gateway/public/bos-meta.png +0 -0
- package/templates/frontend/gateway/public/favicon.png +0 -0
- package/templates/frontend/gateway/public/fonts/FKGrotesk.woff2 +0 -0
- package/templates/frontend/gateway/public/fonts/Mona-Sans.woff2 +0 -0
- package/templates/frontend/gateway/public/logo192.png +0 -0
- package/templates/frontend/gateway/public/robots.txt +0 -3
- package/templates/frontend/gateway/public/site.webmanifest +0 -8
- package/templates/frontend/gateway/src/assets/images/near-icon.svg +0 -3
- package/templates/frontend/gateway/src/components/MetaTags.tsx +0 -22
- package/templates/frontend/gateway/src/components/component/ComponentWrapperPage.tsx +0 -27
- package/templates/frontend/gateway/src/components/layouts/DefaultLayout.tsx +0 -16
- package/templates/frontend/gateway/src/components/layouts/SimpleLayout.tsx +0 -9
- package/templates/frontend/gateway/src/components/lib/Button/Button.tsx +0 -379
- package/templates/frontend/gateway/src/components/lib/Button/index.tsx +0 -1
- package/templates/frontend/gateway/src/components/lib/Spinner/Spinner.tsx +0 -33
- package/templates/frontend/gateway/src/components/lib/Spinner/index.ts +0 -1
- package/templates/frontend/gateway/src/components/lib/Text/Text.tsx +0 -14
- package/templates/frontend/gateway/src/components/lib/Text/index.tsx +0 -1
- package/templates/frontend/gateway/src/components/lib/Toast/README.md +0 -83
- package/templates/frontend/gateway/src/components/lib/Toast/Toast.tsx +0 -25
- package/templates/frontend/gateway/src/components/lib/Toast/Toaster.tsx +0 -48
- package/templates/frontend/gateway/src/components/lib/Toast/api.ts +0 -6
- package/templates/frontend/gateway/src/components/lib/Toast/index.ts +0 -3
- package/templates/frontend/gateway/src/components/lib/Toast/store.ts +0 -83
- package/templates/frontend/gateway/src/components/lib/Toast/styles.ts +0 -126
- package/templates/frontend/gateway/src/components/navigation/Navigation.tsx +0 -23
- package/templates/frontend/gateway/src/components/navigation/UserDropdownMenu.tsx +0 -209
- package/templates/frontend/gateway/src/components/navigation/desktop/DesktopNavigation.tsx +0 -109
- package/templates/frontend/gateway/src/components/navigation/desktop/MainNavigationMenu.tsx +0 -170
- package/templates/frontend/gateway/src/components/navigation/icons/close.svg +0 -22
- package/templates/frontend/gateway/src/components/navigation/icons/near-icon.svg +0 -3
- package/templates/frontend/gateway/src/components/navigation/icons/near-logo.svg +0 -14
- package/templates/frontend/gateway/src/components/navigation/icons/return.svg +0 -29
- package/templates/frontend/gateway/src/components/navigation/icons/search.svg +0 -3
- package/templates/frontend/gateway/src/components/navigation/mobile/AccordionMenu.tsx +0 -141
- package/templates/frontend/gateway/src/components/navigation/mobile/Menu.tsx +0 -86
- package/templates/frontend/gateway/src/components/navigation/mobile/MobileNavigation.tsx +0 -131
- package/templates/frontend/gateway/src/components/navigation/navigation-categories.ts +0 -75
- package/templates/frontend/gateway/src/components/vm/VmCommitButton.tsx +0 -20
- package/templates/frontend/gateway/src/components/vm/VmComponent.tsx +0 -29
- package/templates/frontend/gateway/src/components/vm/VmInitializer.tsx +0 -124
- package/templates/frontend/gateway/src/data/components.ts +0 -50
- package/templates/frontend/gateway/src/hooks/useBosComponents.ts +0 -14
- package/templates/frontend/gateway/src/hooks/useBosLoaderInitializer.ts +0 -60
- package/templates/frontend/gateway/src/hooks/useFlags.ts +0 -40
- package/templates/frontend/gateway/src/hooks/useLayout.tsx +0 -12
- package/templates/frontend/gateway/src/index.d.ts +0 -9
- package/templates/frontend/gateway/src/pages/_app.tsx +0 -47
- package/templates/frontend/gateway/src/pages/_document.tsx +0 -27
- package/templates/frontend/gateway/src/pages/dig.tsx +0 -25
- package/templates/frontend/gateway/src/pages/flags.tsx +0 -83
- package/templates/frontend/gateway/src/pages/hello-api.tsx +0 -105
- package/templates/frontend/gateway/src/pages/hello-component.tsx +0 -23
- package/templates/frontend/gateway/src/pages/hello-ethereum.tsx +0 -23
- package/templates/frontend/gateway/src/pages/hello-social.tsx +0 -31
- package/templates/frontend/gateway/src/pages/index.tsx +0 -51
- package/templates/frontend/gateway/src/pages/nui.tsx +0 -25
- package/templates/frontend/gateway/src/stores/auth.ts +0 -29
- package/templates/frontend/gateway/src/stores/bos-loader.ts +0 -20
- package/templates/frontend/gateway/src/stores/current-component.ts +0 -11
- package/templates/frontend/gateway/src/stores/vm.ts +0 -24
- package/templates/frontend/gateway/src/styles/globals.css +0 -68
- package/templates/frontend/gateway/src/styles/theme.css +0 -129
- package/templates/frontend/gateway/src/utils/config.ts +0 -49
- package/templates/frontend/gateway/src/utils/form-validation.ts +0 -18
- package/templates/frontend/gateway/src/utils/keypom-options.ts +0 -59
- package/templates/frontend/gateway/src/utils/route/privateRoute.tsx +0 -20
- package/templates/frontend/gateway/src/utils/route/signedOutRoute.tsx +0 -21
- package/templates/frontend/gateway/src/utils/types.ts +0 -33
- package/templates/frontend/gateway/tsconfig.json +0 -24
- package/templates/frontend/vanilla/.env +0 -1
- package/templates/frontend/vanilla/index.html +0 -97
- package/templates/frontend/vanilla/index.js +0 -70
- package/templates/shared/template.gitignore +0 -31
- /package/templates/contracts/{rust → rs}/.cargo/config +0 -0
- /package/templates/contracts/{rust → rs}/rust-toolchain.toml +0 -0
- /package/templates/contracts/{js → ts}/package-lock.json +0 -0
- /package/templates/contracts/{js → ts}/src/contract.ts +0 -0
- /package/templates/contracts/{js → ts}/tsconfig.json +0 -0
- /package/templates/frontend/{gateway → next}/public/next.svg +0 -0
- /package/templates/frontend/{gateway → next}/public/vercel.svg +0 -0
- /package/templates/frontend/{gateway/public → next/src/app}/favicon.ico +0 -0
- /package/templates/{shared → frontend/vanilla}/.gitpod.yml +0 -0
- /package/templates/{shared → frontend/vanilla}/README.md +0 -0
- /package/templates/frontend/vanilla/{assets → src/assets}/favicon.ico +0 -0
- /package/templates/frontend/vanilla/{assets → src/assets}/logo-black.svg +0 -0
- /package/templates/frontend/vanilla/{assets → src/assets}/logo-white.svg +0 -0
- /package/templates/{integration-tests/rust-tests → sandbox-tests/sandbox-rs}/src/tests.rs +0 -0
- /package/templates/{integration-tests/js-tests → sandbox-tests/sandbox-ts}/ava.config.cjs +0 -0
- /package/templates/{integration-tests/js-tests → sandbox-tests/sandbox-ts}/package-lock.json +0 -0
- /package/templates/{integration-tests/js-tests → sandbox-tests/sandbox-ts}/src/main.ava.ts +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Toast
|
|
2
|
-
|
|
3
|
-
Implemented via Radix primitives: https://www.radix-ui.com/docs/primitives/components/toast
|
|
4
|
-
|
|
5
|
-
_If the current props and Stitches style overrides aren't enough to cover your use case, feel free to implement your own component using the Radix primitives directly._
|
|
6
|
-
|
|
7
|
-
## Example
|
|
8
|
-
|
|
9
|
-
Using the `openToast` API allows you to easily open a toast from any context:
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import { openToast } from '@/components/lib/Toast';
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
|
|
16
|
-
<Button
|
|
17
|
-
onClick={() =>
|
|
18
|
-
openToast({
|
|
19
|
-
type: 'ERROR',
|
|
20
|
-
title: 'Toast Title',
|
|
21
|
-
description: 'This is a great toast description.',
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
>
|
|
25
|
-
Open a Toast
|
|
26
|
-
</Button>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
You can pass other options too:
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
<Button
|
|
33
|
-
onClick={() =>
|
|
34
|
-
openToast({
|
|
35
|
-
type: 'SUCCESS', // SUCCESS | INFO | ERROR
|
|
36
|
-
title: 'Toast Title',
|
|
37
|
-
description: 'This is a great toast description.',
|
|
38
|
-
icon: 'ph-bold ph-pizza', // https://phosphoricons.com/
|
|
39
|
-
duration: 20000, // milliseconds (pass Infinity to disable auto close)
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
>
|
|
43
|
-
Open a Toast
|
|
44
|
-
</Button>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Deduplicate
|
|
48
|
-
|
|
49
|
-
If you need to ensure only a single instance of a toast is ever displayed at once, you can deduplicate by passing a unique `id` key. If a toast with the passed `id` is currently open, a new toast will not be opened:
|
|
50
|
-
|
|
51
|
-
```tsx
|
|
52
|
-
<Button
|
|
53
|
-
onClick={() =>
|
|
54
|
-
openToast({
|
|
55
|
-
id: 'my-unique-toast',
|
|
56
|
-
title: 'Toast Title',
|
|
57
|
-
description: 'This is a great toast description.',
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
>
|
|
61
|
-
Deduplicated Toast
|
|
62
|
-
</Button>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Custom Toast
|
|
66
|
-
|
|
67
|
-
If you need something more custom, you can render a custom toast using `lib/Toast/Toaster.tsx` as an example like so:
|
|
68
|
-
|
|
69
|
-
```tsx
|
|
70
|
-
import * as Toast from '@/components/lib/Toast';
|
|
71
|
-
|
|
72
|
-
...
|
|
73
|
-
|
|
74
|
-
<Toast.Provider duration={5000}>
|
|
75
|
-
<Toast.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
76
|
-
<Toast.Title>My Title</Toast.Title>
|
|
77
|
-
<Toast.Description>My Description</Toast.Description>
|
|
78
|
-
<Toast.CloseButton />
|
|
79
|
-
</Toast.Root>
|
|
80
|
-
|
|
81
|
-
<Toast.Viewport />
|
|
82
|
-
</Toast.Provider>
|
|
83
|
-
```
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
2
|
-
import type { ComponentProps } from 'react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import * as S from './styles';
|
|
6
|
-
|
|
7
|
-
type CloseButtonProps = ComponentProps<typeof S.CloseButton>;
|
|
8
|
-
|
|
9
|
-
export const Root = S.Root;
|
|
10
|
-
export const Title = S.Title;
|
|
11
|
-
export const Description = S.Description;
|
|
12
|
-
export const Content = S.Content;
|
|
13
|
-
export const Viewport = S.Viewport;
|
|
14
|
-
export const Action = ToastPrimitive.Action;
|
|
15
|
-
export const Provider = ToastPrimitive.Provider;
|
|
16
|
-
export const Close = ToastPrimitive.Close;
|
|
17
|
-
|
|
18
|
-
export const CloseButton = forwardRef<HTMLButtonElement, CloseButtonProps>((props, ref) => {
|
|
19
|
-
return (
|
|
20
|
-
<S.CloseButton aria-label="Close" ref={ref} {...props}>
|
|
21
|
-
<i className="ph-bold ph-x"></i>
|
|
22
|
-
</S.CloseButton>
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
CloseButton.displayName = 'CloseButton';
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Toast, ToastType } from './store';
|
|
2
|
-
import { useToasterStore } from './store';
|
|
3
|
-
import * as T from './Toast';
|
|
4
|
-
|
|
5
|
-
export function Toaster() {
|
|
6
|
-
const toaster = useToasterStore();
|
|
7
|
-
|
|
8
|
-
const iconsByType: Record<ToastType, string> = {
|
|
9
|
-
INFO: 'ph ph-info',
|
|
10
|
-
WARNING: 'ph ph-warning',
|
|
11
|
-
ERROR: 'ph ph-warning-circle',
|
|
12
|
-
SUCCESS: 'ph ph-check-circle',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
function onOpenChange(open: boolean, toast: Toast) {
|
|
16
|
-
if (!open) toaster.close(toast);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<T.Provider duration={5000}>
|
|
21
|
-
{toaster.toasts.map((toast) => {
|
|
22
|
-
const type = toast.type || 'INFO';
|
|
23
|
-
const icon = toast.icon || iconsByType[type];
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<T.Root
|
|
27
|
-
data-type={type}
|
|
28
|
-
duration={toast.duration}
|
|
29
|
-
open={toast.isOpen}
|
|
30
|
-
onOpenChange={(open) => onOpenChange(open, toast)}
|
|
31
|
-
key={toast.id}
|
|
32
|
-
>
|
|
33
|
-
<i className={icon} />
|
|
34
|
-
|
|
35
|
-
<T.Content>
|
|
36
|
-
<T.Title>{toast.title}</T.Title>
|
|
37
|
-
{toast.description && <T.Description>{toast.description}</T.Description>}
|
|
38
|
-
</T.Content>
|
|
39
|
-
|
|
40
|
-
<T.CloseButton data-type={type} />
|
|
41
|
-
</T.Root>
|
|
42
|
-
);
|
|
43
|
-
})}
|
|
44
|
-
|
|
45
|
-
<T.Viewport />
|
|
46
|
-
</T.Provider>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
|
|
3
|
-
export type ToastType = 'INFO' | 'ERROR' | 'SUCCESS' | 'WARNING';
|
|
4
|
-
|
|
5
|
-
export interface Toast {
|
|
6
|
-
description?: string;
|
|
7
|
-
duration?: number;
|
|
8
|
-
icon?: string;
|
|
9
|
-
id: string;
|
|
10
|
-
isOpen: boolean;
|
|
11
|
-
title: string;
|
|
12
|
-
type?: ToastType;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface OpenToastOptions {
|
|
16
|
-
description?: string;
|
|
17
|
-
duration?: number;
|
|
18
|
-
icon?: string;
|
|
19
|
-
id?: string;
|
|
20
|
-
title: string;
|
|
21
|
-
type?: ToastType;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface ToasterStore {
|
|
25
|
-
toasts: Toast[];
|
|
26
|
-
close: (toast: Toast) => void;
|
|
27
|
-
destroy: (toast: Toast) => void;
|
|
28
|
-
open: (options: OpenToastOptions) => void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const useToasterStore = create<ToasterStore>((set) => ({
|
|
32
|
-
toasts: [],
|
|
33
|
-
|
|
34
|
-
close: (toast) => {
|
|
35
|
-
set((state) => {
|
|
36
|
-
const toasts = state.toasts.map((t) => {
|
|
37
|
-
if (t.id === toast.id) {
|
|
38
|
-
return {
|
|
39
|
-
...t,
|
|
40
|
-
isOpen: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return t;
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
state.destroy(toast);
|
|
49
|
-
}, 5000);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
toasts,
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
destroy: (toast) => {
|
|
58
|
-
set((state) => {
|
|
59
|
-
const toasts = state.toasts.filter((t) => t.id !== toast.id);
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
toasts,
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
open: (options) => {
|
|
68
|
-
const newToast = {
|
|
69
|
-
...options,
|
|
70
|
-
isOpen: true,
|
|
71
|
-
id: options.id || Date.now().toString(),
|
|
72
|
-
type: options.type || 'INFO',
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
set((state) => {
|
|
76
|
-
const toasts = state.toasts.filter((t) => t.id !== newToast.id);
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
toasts: [...toasts, newToast],
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
}));
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
2
|
-
import styled, { keyframes } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
const hideAnimation = keyframes`
|
|
5
|
-
from { opacity: 1; }
|
|
6
|
-
to { opacity: 0; }
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
const slideInAnimation = keyframes`
|
|
10
|
-
from { transform: translateX(calc(100% + 1rem)) }
|
|
11
|
-
to { transform: translateX(0) }
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
const swipeOutAnimation = keyframes`
|
|
15
|
-
from { transform: translateX(var(--radix-toast-swipe-end-x)) }
|
|
16
|
-
to { transform: translateX(calc(100% + 1rem)) }
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
export const Viewport = styled(ToastPrimitive.Viewport)`
|
|
20
|
-
position: fixed;
|
|
21
|
-
bottom: 0;
|
|
22
|
-
right: 0;
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
gap: 1rem;
|
|
26
|
-
padding: 1rem;
|
|
27
|
-
width: 100%;
|
|
28
|
-
max-height: 100vh;
|
|
29
|
-
max-width: 20rem;
|
|
30
|
-
z-index: 2147483632;
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
export const Root = styled(ToastPrimitive.Root)`
|
|
34
|
-
display: flex;
|
|
35
|
-
gap: 1rem;
|
|
36
|
-
align-items: center;
|
|
37
|
-
background: #000;
|
|
38
|
-
color: #fff;
|
|
39
|
-
border-radius: 1rem;
|
|
40
|
-
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
|
41
|
-
padding: 1rem;
|
|
42
|
-
|
|
43
|
-
i {
|
|
44
|
-
font-size: 1.4rem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&[data-state='open'] {
|
|
48
|
-
animation: ${slideInAnimation} 200ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
49
|
-
}
|
|
50
|
-
&[data-state='closed'] {
|
|
51
|
-
animation: ${hideAnimation} 200ms ease-in forwards;
|
|
52
|
-
}
|
|
53
|
-
&[data-swipe='move'] {
|
|
54
|
-
transform: translateX(var(--radix-toast-swipe-move-x));
|
|
55
|
-
}
|
|
56
|
-
&[data-swipe='cancel'] {
|
|
57
|
-
transform: translateX(0);
|
|
58
|
-
transition: transform 200ms ease-out;
|
|
59
|
-
}
|
|
60
|
-
&[data-swipe='end'] {
|
|
61
|
-
animation: ${swipeOutAnimation} 100ms ease-out forwards;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&[data-type='ERROR'] {
|
|
65
|
-
background: var(--red11);
|
|
66
|
-
}
|
|
67
|
-
&[data-type='SUCCESS'] {
|
|
68
|
-
background: var(--green11);
|
|
69
|
-
}
|
|
70
|
-
&[data-type='INFO'] {
|
|
71
|
-
background: var(--sand12);
|
|
72
|
-
}
|
|
73
|
-
&[data-type='WARNING'] {
|
|
74
|
-
background: var(--amber4);
|
|
75
|
-
color: var(--amber12);
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
export const Content = styled.div`
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-direction: column;
|
|
82
|
-
width: 100%;
|
|
83
|
-
gap: 0rem;
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
export const Title = styled(ToastPrimitive.Title)`
|
|
87
|
-
font: 450 16px/1.5 'Mona Sans', sans-serif;
|
|
88
|
-
color: currentColor;
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
export const Description = styled(ToastPrimitive.Description)`
|
|
92
|
-
font: 450 14px/1.5 'Mona Sans', sans-serif;
|
|
93
|
-
color: currentColor;
|
|
94
|
-
opacity: 0.8;
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
export const CloseButton = styled(ToastPrimitive.Close)`
|
|
98
|
-
display: flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
justify-content: center;
|
|
101
|
-
width: 1.5rem;
|
|
102
|
-
height: 1.5rem;
|
|
103
|
-
flex-shrink: 0;
|
|
104
|
-
border-radius: 100%;
|
|
105
|
-
cursor: pointer;
|
|
106
|
-
color: #fff;
|
|
107
|
-
border: 2px solid rgba(255, 255, 255, 0.25);
|
|
108
|
-
background: none;
|
|
109
|
-
transition: all 200ms;
|
|
110
|
-
|
|
111
|
-
&:hover {
|
|
112
|
-
border-color: rgba(255, 255, 255, 0.5);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
&:focus {
|
|
116
|
-
border-color: rgba(255, 255, 255, 1);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
i {
|
|
120
|
-
font-size: 0.8rem;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&[data-type='WARNING'] {
|
|
124
|
-
color: var(--amber12);
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { DesktopNavigation } from './desktop/DesktopNavigation';
|
|
4
|
-
import { MobileNavigation } from './mobile/MobileNavigation';
|
|
5
|
-
|
|
6
|
-
export const Navigation = () => {
|
|
7
|
-
const [matches, setMatches] = useState(true);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
setMatches(window.matchMedia('(min-width: 1024px)').matches);
|
|
11
|
-
}, []);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
window.matchMedia('(min-width: 1024px)').addEventListener('change', (e) => setMatches(e.matches));
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
{matches && <DesktopNavigation />}
|
|
20
|
-
{!matches && <MobileNavigation />}
|
|
21
|
-
</>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { VmComponent } from '@/components/vm/VmComponent';
|
|
5
|
-
import { useBosComponents } from '@/hooks/useBosComponents';
|
|
6
|
-
import { useAuthStore } from '@/stores/auth';
|
|
7
|
-
|
|
8
|
-
const Wrapper = styled.div`
|
|
9
|
-
> button {
|
|
10
|
-
all: unset;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
border-radius: 50px;
|
|
14
|
-
background-color: var(--sand12);
|
|
15
|
-
padding: 4px;
|
|
16
|
-
transition: all 200ms;
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
background-color: var(--black);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:focus {
|
|
23
|
-
box-shadow: 0 0 0 4px var(--violet4);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
.d-inline-block {
|
|
27
|
-
width: unset !important;
|
|
28
|
-
height: unset !important;
|
|
29
|
-
img {
|
|
30
|
-
border-radius: 50% !important;
|
|
31
|
-
width: 38px !important;
|
|
32
|
-
height: 38px !important;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
i {
|
|
37
|
-
color: #a1a09a;
|
|
38
|
-
margin: 0 5px 0 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.profile-info {
|
|
42
|
-
margin: 0 8px;
|
|
43
|
-
line-height: normal;
|
|
44
|
-
max-width: 110px;
|
|
45
|
-
font-size: 12px;
|
|
46
|
-
|
|
47
|
-
.profile-name,
|
|
48
|
-
.profile-username {
|
|
49
|
-
text-overflow: ellipsis;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.profile-name {
|
|
54
|
-
color: white;
|
|
55
|
-
}
|
|
56
|
-
.profile-username {
|
|
57
|
-
color: #a1a09a;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.DropdownMenuContent {
|
|
62
|
-
background-color: #161615;
|
|
63
|
-
border-radius: 6px;
|
|
64
|
-
margin-top: 11px;
|
|
65
|
-
padding: 12px;
|
|
66
|
-
box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
|
|
67
|
-
animation-duration: 600ms;
|
|
68
|
-
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
69
|
-
will-change: transform, opacity;
|
|
70
|
-
z-index: 10000000;
|
|
71
|
-
}
|
|
72
|
-
.DropdownMenuContent[data-side='top'] {
|
|
73
|
-
animation-name: slideDownAndFade;
|
|
74
|
-
}
|
|
75
|
-
.DropdownMenuContent[data-side='right'] {
|
|
76
|
-
animation-name: slideLeftAndFade;
|
|
77
|
-
}
|
|
78
|
-
.DropdownMenuContent[data-side='bottom'] {
|
|
79
|
-
animation-name: slideUpAndFade;
|
|
80
|
-
}
|
|
81
|
-
.DropdownMenuContent[data-side='left'] {
|
|
82
|
-
animation-name: slideRightAndFade;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.DropdownMenuItem {
|
|
86
|
-
all: unset;
|
|
87
|
-
font-size: 13px;
|
|
88
|
-
line-height: 1;
|
|
89
|
-
color: #9ba1a6;
|
|
90
|
-
border-radius: 3px;
|
|
91
|
-
display: flex;
|
|
92
|
-
align-items: center;
|
|
93
|
-
padding: 12px;
|
|
94
|
-
position: relative;
|
|
95
|
-
user-select: none;
|
|
96
|
-
outline: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.DropdownMenuItem:hover {
|
|
100
|
-
color: white;
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.DropdownMenuItem i {
|
|
105
|
-
font-size: 20px;
|
|
106
|
-
margin-right: 10px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@keyframes slideUpAndFade {
|
|
110
|
-
from {
|
|
111
|
-
opacity: 0;
|
|
112
|
-
transform: translateY(2px);
|
|
113
|
-
}
|
|
114
|
-
to {
|
|
115
|
-
opacity: 1;
|
|
116
|
-
transform: translateY(0);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@keyframes slideRightAndFade {
|
|
121
|
-
from {
|
|
122
|
-
opacity: 0;
|
|
123
|
-
transform: translateX(-2px);
|
|
124
|
-
}
|
|
125
|
-
to {
|
|
126
|
-
opacity: 1;
|
|
127
|
-
transform: translateX(0);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@keyframes slideDownAndFade {
|
|
132
|
-
from {
|
|
133
|
-
opacity: 0;
|
|
134
|
-
transform: translateY(-2px);
|
|
135
|
-
}
|
|
136
|
-
to {
|
|
137
|
-
opacity: 1;
|
|
138
|
-
transform: translateY(0);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@keyframes slideLeftAndFade {
|
|
143
|
-
from {
|
|
144
|
-
opacity: 0;
|
|
145
|
-
transform: translateX(2px);
|
|
146
|
-
}
|
|
147
|
-
to {
|
|
148
|
-
opacity: 1;
|
|
149
|
-
transform: translateX(0);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
@media (max-width: 800px) {
|
|
154
|
-
.profile-info,
|
|
155
|
-
.ph {
|
|
156
|
-
display: none;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
> button {
|
|
160
|
-
background: var(--sand6);
|
|
161
|
-
padding: 1px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.d-inline-block {
|
|
165
|
-
img {
|
|
166
|
-
width: 43px !important;
|
|
167
|
-
height: 43px !important;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
`;
|
|
172
|
-
|
|
173
|
-
export const UserDropdownMenu = () => {
|
|
174
|
-
const accountId = useAuthStore((store) => store.accountId);
|
|
175
|
-
const logOut = useAuthStore((store) => store.logOut);
|
|
176
|
-
const components = useBosComponents();
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<Wrapper>
|
|
180
|
-
<DropdownMenu.Root>
|
|
181
|
-
<DropdownMenu.Trigger>
|
|
182
|
-
<VmComponent
|
|
183
|
-
src={components.UI.profileImage}
|
|
184
|
-
props={{
|
|
185
|
-
accountId,
|
|
186
|
-
className: 'd-inline-block',
|
|
187
|
-
}}
|
|
188
|
-
/>
|
|
189
|
-
<div className="profile-info">
|
|
190
|
-
<div className="profile-name">
|
|
191
|
-
<VmComponent src={components.UI.profileName} />
|
|
192
|
-
</div>
|
|
193
|
-
<div className="profile-username">{accountId}</div>
|
|
194
|
-
</div>
|
|
195
|
-
<i className="ph ph-caret-down"></i>
|
|
196
|
-
</DropdownMenu.Trigger>
|
|
197
|
-
|
|
198
|
-
<DropdownMenu.Content className="DropdownMenuContent" sideOffset={-5}>
|
|
199
|
-
<DropdownMenu.Item className="DropdownMenuItem" onClick={() => logOut()}>
|
|
200
|
-
<i className="ph-duotone ph-sign-out"></i>
|
|
201
|
-
Sign out
|
|
202
|
-
</DropdownMenu.Item>
|
|
203
|
-
|
|
204
|
-
<DropdownMenu.Arrow style={{ fill: '#161615' }} />
|
|
205
|
-
</DropdownMenu.Content>
|
|
206
|
-
</DropdownMenu.Root>
|
|
207
|
-
</Wrapper>
|
|
208
|
-
);
|
|
209
|
-
};
|