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

dev -> main #131

Merged
merged 26 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bc5c28b
Change analytics target url (#96)
DimitarTAtanasov Oct 9, 2024
ec5784b
fix signer (#97)
nikolaicholakov25 Oct 10, 2024
1f8255f
Added og tags (#98)
DimitarTAtanasov Oct 14, 2024
38b216f
feat: Add papi supported chains (#95)
nikolaicholakov25 Oct 15, 2024
d07d5f5
Handle decoding failure for kusama asset hub (#99)
nikolaicholakov25 Oct 16, 2024
efec0d1
Add decoders page (#82)
nikolaicholakov25 Oct 17, 2024
663a9bc
snippet improvements (#100)
nikolaicholakov25 Oct 17, 2024
dd7dbf4
refactor chain clients (#103)
nikolaicholakov25 Oct 17, 2024
c2a38a6
fix latest-blocks page identity column format error (#104)
nikolaicholakov25 Oct 18, 2024
136c32e
add og:image (#106)
nikolaicholakov25 Oct 21, 2024
bdb197f
fix: paddings on block details page (#101)
AlexanderDrazhev Oct 21, 2024
574e158
fix: the connect wallet button paddings (#102)
AlexanderDrazhev Oct 21, 2024
6102472
clean up (#109)
nikolaicholakov25 Oct 22, 2024
82c6056
Create LICENSE (#110)
nikolaicholakov25 Oct 22, 2024
5439ccb
remove jszip (#111)
nikolaicholakov25 Oct 22, 2024
e5a0b29
remove old home links (#112)
nikolaicholakov25 Oct 22, 2024
7e440be
update license (#114)
nikolaicholakov25 Oct 23, 2024
97c1449
fix: Helmet title name (#116)
AlexanderDrazhev Oct 24, 2024
af9e85c
feat: include the default extrinsics on the latest blocks list (#113)
AlexanderDrazhev Oct 25, 2024
2ad9c17
Dev deploy (#122)
DimitarTAtanasov Oct 29, 2024
142c07b
Test log (#124)
DimitarTAtanasov Oct 29, 2024
3e9ba1b
Merge branch 'main' into dev
DimitarTAtanasov Oct 29, 2024
650c69b
Remove log (#126)
DimitarTAtanasov Oct 29, 2024
f871112
[feat] Custom Examples (#128)
Denis-Dinkov Nov 6, 2024
548cd5d
Fix UI Extrinsics/Events list expand icon, block details and forks co…
AlexanderDrazhev Nov 7, 2024
75c2dd0
fix the issue with copyToClipboard component (#133)
AlexanderDrazhev Nov 7, 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
48 changes: 30 additions & 18 deletions src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
useStoreWallet,
} from '@stores';
import { analyticsApp } from 'firebaseConfig';
import { useStoreCustomExamples } from 'src/stores/examples';

import { routes } from './routes';

Expand Down Expand Up @@ -54,32 +55,43 @@ export const App = () => {
resetStore: resetStoreWallet,
} = useStoreWallet.use.actions();

const initStoreExamples = useStoreCustomExamples.use.init?.();
const { resetStore: resetStoreExamples } = useStoreCustomExamples.use.actions();

useEffect(() => {
initStoreAuth();
initStoreUI();
initStoreChainClient();
initStoreWallet();

window.customPackages = {};
Object.assign(window.customPackages, {
createClient,
...createClient,
papiDescriptors,
...papiDescriptors,
getPolkadotSigner,
connectInjectedExtension,
getInjectedExtensions,
});
const initializeStores = async () => {
await initStoreAuth();
initStoreUI();
initStoreChainClient();
initStoreWallet();
initStoreExamples();

window.customPackages = {};
Object.assign(window.customPackages, {
createClient,
...createClient,
papiDescriptors,
...papiDescriptors,
getPolkadotSigner,
connectInjectedExtension,
getInjectedExtensions,
});

refTimeout.current = setTimeout(() => {
document.body.removeAttribute('style');
}, 400);
refTimeout.current = setTimeout(() => {
document.body.removeAttribute('style');
}, 400);
};

initializeStores().catch((error) => {
console.error('Error initializing stores', error);
});

return () => {
resetStoreAuth();
resetStoreUI();
void resetStoreChain();
resetStoreWallet();
resetStoreExamples();
};

// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
3 changes: 3 additions & 0 deletions src/assets/svgs/icon/expand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svgs/icon/loader.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/svgs/icon/logout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/svgs/icon/pen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/svgs/icon/trash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 10 additions & 5 deletions src/components/copyToClipboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
interface ICopyToClipboardProps {
text: string;
toastMessage?: string;
children: (props: { ClipboardIcon: ReactNode; onClick: (e: React.MouseEvent) => void }) => ReactElement;
children: (props: { ClipboardIcon: ReactNode; onClick: (e: React.MouseEvent) => void; text: string }) => ReactElement;
onCopy?: (success: boolean, text: string) => void;
showToast?: boolean;
className?: string;
Expand Down Expand Up @@ -122,8 +122,13 @@ export const CopyToClipboard = memo((props: ICopyToClipboardProps) => {
isCopied,
]);

return children({
ClipboardIcon,
onClick: copyToClipboard,
});
return (
<>
{children({
ClipboardIcon,
onClick: copyToClipboard,
text,
})}
</>
);
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { Icon } from '@components/icon';
import { PDLink } from '@components/pdLink';
import { useStoreAuth } from '@stores';
import { cn } from '@utils/helpers';

export const NotFound = () => {
interface ExampleNotFoundProps {
classes?: string;
iconClasses?: string;
textClasses?: string;
onClick?: () => void;
}

export const ExampleNotFound = (props: ExampleNotFoundProps) => {
const { classes, iconClasses, textClasses, onClick } = props;
const isAuthenticated = useStoreAuth.use.jwtToken?.();
const { authorize } = useStoreAuth.use.actions();

Expand All @@ -16,9 +25,14 @@ export const NotFound = () => {
'mb-8',
'self-center text-dev-white-1000',
'dark:text-dev-purple-50',
iconClasses,
)}
/>
<div className="flex flex-col items-center justify-center">
<div className={cn(
'flex flex-col items-center justify-center',
textClasses,
)}
>
<h4 className="mb-4 self-center font-h4-bold">Please Log in</h4>
<p className="max-w-80 text-center font-geist">
To access your custom examples, please log in using your GitHub account.
Expand All @@ -40,31 +54,62 @@ export const NotFound = () => {
}

return (
<div className="flex flex-col">
<div className={cn(
'flex flex-col',
classes,
)}
>
<Icon
name="icon-group"
size={[128]}
className={cn(
'mb-8',
'self-center text-dev-white-1000',
'dark:text-dev-purple-50',
iconClasses,
)}
/>
<div className="flex flex-col items-center justify-center">
<div className={cn(
'flex flex-col items-center justify-center',
textClasses,
)}
>
<h4 className="mb-4 self-center font-h4-bold">Nothing here</h4>
<p className="max-w-80 text-center font-geist">
Currently, you don't have any custom examples created. Ready to create one?
</p>
<button
className={cn(
'mb-2 mt-6 w-full p-4 transition-colors',
'font-geist text-white font-body2-bold',
'bg-dev-pink-500',
'hover:bg-dev-pink-400',
)}
>
Create Example
</button>

{
onClick
? (
<button
onClick={onClick}
className={cn(
'mb-2 mt-6 w-full p-4 transition-colors',
'font-geist text-white font-body2-bold',
'bg-dev-pink-500',
'hover:bg-dev-pink-400',
)}
>
Create Example
</button>
)
: (
<PDLink to="/code?d=1">
<button
className={cn(
'mb-2 mt-6 w-full p-4 transition-colors',
'font-geist text-white font-body2-bold',
'bg-dev-pink-500',
'hover:bg-dev-pink-400',
)}
>
Create Example
</button>
</PDLink>
)
}

</div>
</div>
);
Expand Down
84 changes: 61 additions & 23 deletions src/components/githubButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { useToggleVisibility } from '@pivanov/use-toggle-visibility';
import { useCallback } from 'react';

import { Icon } from '@components/icon';
import { ModalGithubLogin } from '@components/modals/modalGithubLogin';
import { useStoreAuth } from '@stores';
import { cn } from '@utils/helpers';
import { useStoreCustomExamples } from 'src/stores/examples';

export const GithubButton = () => {
const [
Expand All @@ -12,33 +14,69 @@ export const GithubButton = () => {
] = useToggleVisibility(ModalGithubLogin);

const { logout } = useStoreAuth.use.actions();
const authIsLoading = useStoreAuth.use.jwtTokenIsLoading?.();
const { name, avatar } = useStoreAuth.use.user();
const isAuthenticated = useStoreAuth.use.jwtToken?.();
const { resetStore } = useStoreCustomExamples.use.actions();

const handleLogout = useCallback(async () => {
resetStore();
await logout();
}, [
logout,
resetStore,
]);

return (
<div className="mb-4 flex h-16 items-center">
<button
disabled={authIsLoading}
onClick={isAuthenticated ? logout : toggleVisibility}
type="button"
className={cn(
'flex h-12 cursor-pointer items-center gap-1',
'ml-auto',
'disabled:cursor-not-allowed disabled:opacity-50',
'font-geist font-body1-bold',
'relative',
'after:absolute after:bottom-0 after:left-0 after:content-[""]',
'after:h-[2px] after:w-full after:bg-dev-pink-500',
'after:opacity-0 after:transition-opacity hover:after:opacity-100',
)}
>
<Icon name="logo-github" />
{
isAuthenticated
? 'Logout'
: 'Login'
}
</button>
{
isAuthenticated
? (
<div className={cn(
'flex h-12 items-center gap-4',
'ml-auto',
'font-geist font-body1-bold',
)}
>
<div className="flex items-center gap-2.5">
<img
alt="avatar"
className="size-8 rounded-full"
src={avatar}
/>
{name.length > 20 ? `${name.slice(0, 20)}..` : name}
</div>
<button
className="flex items-center gap-4 duration-200 hover:text-dev-pink-500"
onClick={handleLogout}
>
<Icon
name="icon-logout"
size={[22]}
/>
</button>
</div>
)
: (
<button
onClick={toggleVisibility}
type="button"
className={cn(
'flex h-12 cursor-pointer items-center gap-1',
'ml-auto',
'disabled:cursor-not-allowed disabled:opacity-50',
'font-geist font-body1-bold',
'relative',
'after:absolute after:bottom-0 after:left-0 after:content-[""]',
'after:h-[2px] after:w-full after:bg-dev-pink-500',
'after:opacity-0 after:transition-opacity hover:after:opacity-100',
)}
>
<Icon name="logo-github" />
Login
</button>
)
}

<GithubModal onClose={toggleVisibility} />
</div>
);
Expand Down
Loading