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 view all buttons on landing page and fix mobile styling #323

Merged
merged 2 commits into from
Nov 22, 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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const truncatedAbi = computed<string>(() => {
<style lang="scss">
.info-field-abi-data {
.abi-data-disclosure-btn {
@apply flex w-full items-center justify-between bg-gray-200 px-4 py-2 text-left text-sm font-medium text-gray-900 hover:bg-gray-200 focus:outline-none;
@apply flex w-full items-center justify-between bg-gray-200 px-4 py-2 text-left text-sm font-medium text-gray-900 hover:bg-gray-200 focus:outline-none [word-break:break-word];
}
.abi-data-disclosure-icons {
@apply flex items-center;
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
"loadingInfoFailed": "Loading transaction info failed",
"transactionNotFound": "Transaction wasn't found",
"transactionInfo": "Transaction info",
"tryRequestAgain": "Try again"
"tryRequestAgain": "Try again",
"viewAll": "View All Transactions"
},
"transactionData": {
"showOriginalInput": "Show original input",
Expand Down Expand Up @@ -272,6 +273,7 @@
"transactionsShort": "txns"
},
"tooltipInfo": "Latest batches submitted to Ethereum Network",
"viewAll": "View All Batches",
"status": {
"verified": "Executed on",
"sealed": "Processed on",
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"loadingInfoFailed": "Не вдалося завантажити інформацію про транзакцію",
"transactionNotFound": "Транзакцію не знайдено",
"transactionInfo": "Інформація про транзакцію",
"tryRequestAgain": "Спробуйте знову"
"tryRequestAgain": "Спробуйте знову",
"viewAll": "Переглянути всі транзакції"
},
"header": {
"nav": {
Expand Down
40 changes: 29 additions & 11 deletions packages/app/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@
<p>{{ t("blockExplorer.batches") }}</p>
<InfoTooltip class="batches-tooltip">{{ t("batches.tooltipInfo") }}</InfoTooltip>
</div>
<TableBatches
v-if="(isBatchesPending || batches) && !isBatchesFailed"
:data-testid="$testId.latestBatchesTable"
:loading="isBatchesPending"
:batches="displayedBatches"
:columns="['status', 'size', 'txnBatch', 'age']"
>
<template #not-found>
<p class="not-found">{{ t("batches.table.notFoundHomePage") }}</p>
</template>
</TableBatches>
<template v-if="(isBatchesPending || batches) && !isBatchesFailed">
<TableBatches
:data-testid="$testId.latestBatchesTable"
:loading="isBatchesPending"
:batches="displayedBatches"
:columns="['status', 'size', 'txnBatch', 'age']"
>
<template #not-found>
<p class="not-found">{{ t("batches.table.notFoundHomePage") }}</p>
</template>
</TableBatches>
<Button variant="outlined" color="primary" @click="router.push('batches')">
{{ t("batches.viewAll") }}
<ArrowRightIcon class="batches-view-all-arrow" />
</Button>
</template>
<span v-else-if="isBatchesFailed" class="error-message">
{{ t("failedRequest") }}
</span>
Expand All @@ -48,6 +53,10 @@
</TableBodyColumn>
</template>
</TransactionsTable>
<Button variant="outlined" color="primary" @click="router.push('transactions')">
{{ t("transactions.viewAll") }}
<ArrowRightIcon class="transactions-view-all-arrow" />
</Button>
</div>
</div>
</div>
Expand All @@ -56,16 +65,21 @@
import { computed } from "vue";
import { useI18n } from "vue-i18n";

import { ArrowRightIcon } from "@heroicons/vue/outline";

import NetworkStats from "@/components/NetworkStats.vue";
import SearchForm from "@/components/SearchForm.vue";
import TableBatches from "@/components/batches/Table.vue";
import Button from "@/components/common/Button.vue";
import InfoTooltip from "@/components/common/InfoTooltip.vue";
import TableBodyColumn from "@/components/common/table/TableBodyColumn.vue";
import TransactionsTable from "@/components/transactions/Table.vue";

import useBatches from "@/composables/useBatches";
import useNetworkStats from "@/composables/useNetworkStats";

import router from "@/router";

const { t } = useI18n();
const { fetch: fetchNetworkStats, pending: networkStatsPending, item: networkStats } = useNetworkStats();
const { load: getBatches, pending: isBatchesPending, failed: isBatchesFailed, data: batches } = useBatches();
Expand Down Expand Up @@ -121,6 +135,10 @@ getBatches(1, new Date());
@apply mb-3;
}
}
.batches-view-all-arrow,
.transactions-view-all-arrow {
@apply w-4 ml-1;
}
}

.error-message {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/AddressView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ vi.mock("vue-router", () => ({
page: vi.fn(),
},
}),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

vi.mock("ohmyfetch", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/BatchView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vi.mock("@/composables/useSearch", () => {
vi.mock("vue-router", () => ({
useRouter: () => router,
useRoute: () => vi.fn(),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

vi.mock("ohmyfetch", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/BatchesView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ vi.mock("vue-router", () => ({
useRoute: () => ({
query: routeQueryMock(),
}),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

import enUS from "@/locales/en.json";
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/BlockView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vi.mock("@/composables/useSearch", () => {
vi.mock("vue-router", () => ({
useRouter: () => router,
useRoute: () => vi.fn(),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

vi.mock("ohmyfetch", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/BlocksView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ vi.mock("vue-router", () => ({
useRoute: () => ({
query: routeQueryMock(),
}),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

import enUS from "@/locales/en.json";
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/ContractVerificationView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ vi.mock("vue-router", () => ({
address: "0x5c221e77624690fff6dd741493d735a17716c26b",
},
}),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

vi.mock("ohmyfetch", () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/app/tests/views/DebuggerView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ describe("DebuggerView:", () => {
vi.mock("vue-router", () => ({
useRouter: () => vi.fn(),
useRoute: () => vi.fn(),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

it("has correct title", async () => {
expect(i18n.global.t(routes.find((e) => e.name === "debugger")?.meta?.title as string)).toBe("zkEVM Debugger");
});
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/HomeView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ vi.mock("ohmyfetch", () => {
vi.mock("vue-router", () => ({
useRouter: () => vi.fn(),
useRoute: () => vi.fn(),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

vi.mock("@/composables/useToken", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/TransactionView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ vi.mock("vue-router", () => ({
useRoute: () => ({
query: {},
}),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

vi.mock("ohmyfetch", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/tests/views/TransactionsView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ vi.mock("vue-router", () => ({
useRoute: () => ({
query: routeQueryMock(),
}),
createWebHistory: () => vi.fn(),
createRouter: () => vi.fn(),
}));

import $testId from "@/plugins/testId";
Expand Down
Loading