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

feat: add filtering #97

Merged
merged 3 commits into from
Nov 13, 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
3 changes: 1 addition & 2 deletions content/tutorials/cross-chain-governance/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ authors:
github_repo: https://github.com/ZKsync-Community-Hub
tags:
- smart contracts
- L1-L2
- tutorial
- cross-chain
summary: Build and deploy a smart contract in L1 and send transactions that update the state of a contract in ZKsync.
description:
In this tutorial we'll deploy a simple smart contract in ZKsync. Then we'll deploy another smart contract in L1 and
Expand Down
2 changes: 0 additions & 2 deletions content/tutorials/custom-zk-chain/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ authors:
github_repo: https://github.com/ZKsync-Community-Hub
tags:
- elastic chain
- zk chain
- tutorial
summary: Create, customize, and run your first ZK chain locally.
description:
In this tutorial, you will get familiar with the ZK Inception CLI. You will create a local Elastic Chain ecosystem and
Expand Down
1 change: 0 additions & 1 deletion content/tutorials/daily-spend-limit-account/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ github_repo: https://github.com/ZKsync-Community-Hub
tags:
- account abstraction
- smart contracts
- tutorial
summary: Build a native smart contract account that has a daily spend limit.
description:
This tutorial will guide you through the process of building a smart contract account that has a daily spend limit.
Expand Down
3 changes: 1 addition & 2 deletions content/tutorials/dapp-nft-paymaster/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ tags:
- paymaster
- frontend
- next.js
- tutorial
- ERC721
- erc721
summary: Build a frontend that allows users to interact smart contracts with zero transaction fees wif they hold an NFT.
description:
This tutorial will guide you through the process of building a frontend that interacts with smart contracts on ZKsync.
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/erc20-paymaster/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tags:
- account abstraction
- paymaster
- smart contracts
- tutorial
- erc20
summary: Build a paymaster that accepts any ERC20 token in exchange for transaction fees.
description:
This tutorial will guide you through the process of building a paymaster that accepts a fixed amount of any ERC20
Expand Down
1 change: 0 additions & 1 deletion content/tutorials/foundry-era-test-node/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ tags:
- foundry
- cast
- uniswap
- tutorial
summary: Set up a local ZKsync Era environment and perform token swaps using Foundry.
description: |
In this tutorial, you will set up a local ZKsync Era environment using era_test_node, leverage Foundry's cast tool to interact with contracts, and perform token swaps on Uniswap. You will learn how to check balances, deposit ETH for WETH, transfer WETH, and swap tokens using Uniswap's Swap Router.
Expand Down
1 change: 0 additions & 1 deletion content/tutorials/frontend-paymaster/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ tags:
- paymaster
- frontend
- vue.js
- tutorial
summary: Build a frontend that allows users to interact smart contracts paying fees with ERC20 tokens on ZKsync.
description:
This tutorial will guide you through the process of building a frontend that interacts with smart contracts on ZKsync.
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/guide-subquery/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors:
github_repo: https://github.com/subquery
tags:
- guide
- SubQuery
- subquery
summary: This page will guide you through the steps to index smart contract events using SubQuery.
description:
This guide outlines the process of indexing all transfers and approval events from the Wrapped ETH on ZKsync Era
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/guide-the-graph/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors:
github_repo: https://github.com/graphprotocol
tags:
- guide
- theGraph
- the graph
summary: This page will guide you through the steps to index smart contract data using theGraph.
description:
This guide outlines the process of indexing all transfers and approval events from the Wrapped ETH on ZKsync Era
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/guide-walletconnect/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors:
github_repo: https://github.com/matter-labs
tags:
- guide
- WalletConnect
- walletconnect
summary: Learn how to use WalletConnect to create React apps that interact with contracts on ZKsync.
description:
This guide outlines how to use WalletConnect and Web3Modal to create React apps that interact with contracts on ZKsync
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/guide-web3js/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors:
github_repo: https://github.com/ChainSafe
tags:
- guide
- Web3.js
- web3.js
summary:
This guide will teach you how to set up and use Web3.js to interact with ZKsync, leveraging the ZKsync Web3.js plugin.
description:
Expand Down
1 change: 1 addition & 0 deletions content/tutorials/how-to-deposit-erc20/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tags:
- hardhat
- how-to
- erc20
- cross-chain
summary: Learn how to deposit ERC20 tokens ZKsync.
description: This how-to guide explains how to create a script that deposits any ERC20 token to ZKsync.
what_you_will_learn:
Expand Down
1 change: 0 additions & 1 deletion content/tutorials/how-to-deposit-eth/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ github_repo: https://github.com/ZKsync-Community-Hub
tags:
- hardhat
- how-to
- Ether
summary: Learn how to deposit Ether to ZKsync.
description: This how-to guide explains how to create a script that deposits Ether to ZKsync.
what_you_will_learn:
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/how-to-send-l1-l2-transaction/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ github_repo: https://github.com/ZKsync-Community-Hub
tags:
- smart contracts
- how-to
- L2-L1 communication
- cross-chain
summary: Learn how to send a transaction from Ethereum that to ZKsync
description:
This how-to guide explains how to send a transaction from Ethereum that interacts with a contract deployed on ZKsync.
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/how-to-send-l2-l1-message/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ github_repo: https://github.com/ZKsync-Community-Hub
tags:
- smart contracts
- how-to
- L2-L1 communication
- cross-chain
summary: Learn how to send a message from ZKsync to Ethereum L1.
description: This how-to guide explains how to send an arbitrary message from ZKsync to Ethereum L1.
what_you_will_learn:
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/how-to-withdraw-eth/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ github_repo: https://github.com/ZKsync-Community-Hub
tags:
- hardhat
- how-to
- Ether
- cross-chain
summary: Learn how to withdraw Ether from ZKsync.
description: This how-to guide explains how to create a script that withdraws Ether from ZKsync.
what_you_will_learn:
Expand Down
1 change: 0 additions & 1 deletion content/tutorials/native-aa-multisig/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ github_repo: https://github.com/ZKsync-Community-Hub
tags:
- account abstraction
- smart contracts
- tutorial
summary: Build a native smart contract account that requires multiple signatures.
description:
This tutorial will guide you through the process of building a smart contract account that requires two ECDSA
Expand Down
4 changes: 1 addition & 3 deletions content/tutorials/permissionless-paymaster/_dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ authors:
github_repo: https://github.com/ondefy/permissionless-multisigner-paymaster
tags:
- paymaster
- gas sponsorship
- tutorial
- eip-712
- account abstraction
summary:
Integrate Zyfi's signature based permissionless multi-signer paymaster in your Dapp to sponsor gas funds for your
users.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ authors:
avatar: https://avatars.githubusercontent.com/u/58856580?v=4
github_repo: https://github.com/ZKsync-Community-Hub
tags:
- webauthn
- account abstraction
- paymaster
- smart contracts
- frontend
- next.js
summary: Learn how to use WebAuthn to sign transactions for smart accounts.
description: In this tutorial, you will learn how to use WebAuthn to sign transactions for smart accounts.
what_you_will_learn:
Expand Down
65 changes: 59 additions & 6 deletions pages/tutorials/index.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
<script setup lang="ts">
import type { NavItem } from '@nuxt/content/types';

const navigation = inject<Ref<NavItem[]>>('navigation');
const navigation = inject<Ref<NavItem[]>>('navigation', ref([]));

const guides = computed(() => {
const tutorialPath = navigation?.value.find((item) => item._path === '/tutorials') ?? { children: [] };
interface Guide {
title: string;
description: string;
_path: string;
tags: string[];
authors: Array<{ name: string; url: string; avatar: string }>;
}

return tutorialPath.children;
const guides = computed<Guide[]>(() => {
const tutorialPath = navigation.value.find((item) => item._path === '/tutorials');
return tutorialPath?.children || [];
});

const allTags = computed(() => {
return guides.value.reduce<string[]>((acc, guide) => {
return acc.concat(guide.tags || []);
}, []);
});

const uniqueTags = computed(() => [...new Set(allTags.value)]);

const activeTag = ref(uniqueTags.value[0] || '');
const isExpanded = ref(false);
const defaultCount = 6;

const visibleTags = computed(() => {
return isExpanded.value ? uniqueTags.value : uniqueTags.value.slice(0, defaultCount);
});

const showToggleButton = computed(() => uniqueTags.value.length > defaultCount);

const filteredGuides = computed(() => {
if (!activeTag.value) return guides.value;
return guides.value.filter((guide) => guide.tags?.includes(activeTag.value));
});
</script>

Expand All @@ -20,9 +50,32 @@ const guides = computed(() => {
icon="i-zkicon-zksync"
/>

<div class="mb-4 mt-4 flex flex-wrap gap-1">
<UBadge
v-for="tag in visibleTags"
:key="tag"
:label="tag"
color="blue"
size="sm"
:variant="activeTag === tag ? 'solid' : 'subtle'"
class="cursor-pointer p-2"
@click="activeTag = tag === activeTag ? '' : tag"
/>

<UButton
v-if="showToggleButton"
size="xs"
variant="ghost"
:ui="{ rounded: 'rounded' }"
@click="isExpanded = !isExpanded"
>
{{ isExpanded ? 'Show Less' : 'Show More' }}
</UButton>
</div>

<ULandingCard
v-for="(guide, index) of guides"
:key="index"
v-for="guide in filteredGuides"
:key="guide._path"
:title="guide.title"
:to="guide._path"
class="mb-4"
Expand Down
3 changes: 2 additions & 1 deletion tests/configs/signing-txns-with-webauthn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ const frontendPart1Steps: IStepConfig = {
'init-next-app': {
action: 'runCommand',
commandFolder: 'tests-output/zksync-webauthn',
preCommand: '<COMMAND> --ts --eslint --src-dir --use-npm --no-app --no-tailwind --import-alias "@/*" frontend',
preCommand:
'<COMMAND> frontend --ts --no-eslint --no-tailwind --src-dir --import-alias "@/*" --use-npm --skip-git --no-app --yes',
},
'wait-for-nextjs-init': {
action: 'wait',
Expand Down
Loading