From 403dcb5e31f313a60d77022caab576b91b394bd9 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 19:24:46 +0530 Subject: [PATCH 1/4] fix: total pages count on pagination. --- src/lib/components/pagination.svelte | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/components/pagination.svelte b/src/lib/components/pagination.svelte index 3824a12b8..65968e4ed 100644 --- a/src/lib/components/pagination.svelte +++ b/src/lib/components/pagination.svelte @@ -7,10 +7,11 @@ export let offset: number; export let hidePages = false; - $: totalPages = Math.ceil(sum / limit); $: currentPage = Math.floor(offset / limit + 1); - $: pages = pagination(currentPage, totalPages); + // TODO: check if we even need these now due to Pink V2. + /*$: totalPages = Math.ceil(sum / limit); + $: pages = pagination(currentPage, totalPages); function pagination(page: number, total: number) { const pagesShown = 5; const start = Math.max( @@ -26,7 +27,7 @@ ...Array.from({ length: end + 1 - start }, (_, i) => i + start), ...(end < total - 1 ? ['...', total] : end < total ? [total] : []) ]; - } + }*/ function getLink(page: number): string { const url = new URL($pageStore.url); @@ -40,7 +41,7 @@ } - + + \ No newline at end of file From e6b9cf12683f5700e1adea6997ce4c42258f2e7b Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 2 Jan 2025 14:04:58 +0530 Subject: [PATCH 3/4] remove: unused var. --- src/lib/components/pagination.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/components/pagination.svelte b/src/lib/components/pagination.svelte index 814f5801d..01be397d6 100644 --- a/src/lib/components/pagination.svelte +++ b/src/lib/components/pagination.svelte @@ -5,8 +5,6 @@ export let sum: number; export let limit: number; export let offset: number; - // eslint-disable-next-line svelte/valid-compile - export let hidePages = false; $: currentPage = Math.floor(offset / limit + 1); From 3959200e0b83fa5558598b9d7c97a7a2cf1bd673 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 2 Jan 2025 14:05:30 +0530 Subject: [PATCH 4/4] ran: formatter. --- CONTRIBUTING.md | 46 +++++++++---------- README.md | 4 +- src/lib/components/pagination.svelte | 2 +- .../sites/site-[site]/logs/+page.ts | 18 +++++--- 4 files changed, 37 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8fcb73389..3d78e77a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,9 +108,9 @@ pnpm run lint Diagnostic tool that checks for the following: -- Unused CSS -- Svelte A11y hints -- TypeScript compiler errors +- Unused CSS +- Svelte A11y hints +- TypeScript compiler errors ```bash pnpm run check @@ -130,11 +130,11 @@ doc-548-submit-a-pull-request-section-to-contribution-guide When `TYPE` can be: -- **feat** - is a new feature -- **doc** - documentation only changes -- **cicd** - changes related to CI/CD system -- **fix** - a bug fix -- **refactor** - code change that neither fixes a bug nor adds a feature +- **feat** - is a new feature +- **doc** - documentation only changes +- **cicd** - changes related to CI/CD system +- **fix** - a bug fix +- **refactor** - code change that neither fixes a bug nor adds a feature **All PRs must include a commit message with a description of the changes made!** @@ -175,12 +175,12 @@ $ git push origin [name_of_your_new_branch] Before committing always make sure to run all available tools to improve the codebase: -- Formatter - - `pnpm run format` -- Tests - - `pnpm test` -- Diagnostics - - `pnpm run check` +- Formatter + - `pnpm run format` +- Tests + - `pnpm test` +- Diagnostics + - `pnpm run check` ### Performance @@ -188,9 +188,9 @@ Page load times are a key consideration for users of all browsers and device typ There are some general things we can do in front-end development: -- Minimize HTTP requests -- Minimize blocking – content should be readable before client-side processing -- Lazy load "supplementary" content, especially images +- Minimize HTTP requests +- Minimize blocking – content should be readable before client-side processing +- Lazy load "supplementary" content, especially images ### Don't Repeat Yourself (DRY) @@ -202,12 +202,12 @@ If you stick to this principle, you will ensure that you will only ever need to Separate _structure_ from _presentation_ from _behavior_ to aid maintainability and understanding. -- Keep CSS (presentation), JS (behavior) and HTML (structure) in the same respective Svelte component -- Avoid writing inline CSS or Javascript in HTML -- Avoid writing CSS or HTML in Javascript -- Don't choose HTML elements to imply style -- Where appropriate, use CSS or Svelte rather than Javascript for animations and transitions -- Try to use templates when defining markup in Javascript +- Keep CSS (presentation), JS (behavior) and HTML (structure) in the same respective Svelte component +- Avoid writing inline CSS or Javascript in HTML +- Avoid writing CSS or HTML in Javascript +- Don't choose HTML elements to imply style +- Where appropriate, use CSS or Svelte rather than Javascript for animations and transitions +- Try to use templates when defining markup in Javascript ### Write code to be read diff --git a/README.md b/README.md index e37369791..9e113f121 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Appwrite Console has been built with the following frameworks: -- [Svelte](https://svelte.dev/) -- [Svelte Kit](https://kit.svelte.dev/) +- [Svelte](https://svelte.dev/) +- [Svelte Kit](https://kit.svelte.dev/) ## Developer Experience diff --git a/src/lib/components/pagination.svelte b/src/lib/components/pagination.svelte index 01be397d6..d2d4aea35 100644 --- a/src/lib/components/pagination.svelte +++ b/src/lib/components/pagination.svelte @@ -20,4 +20,4 @@ } - \ No newline at end of file + diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts b/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts index a5f726fd7..1975c8ddb 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts +++ b/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts @@ -21,12 +21,16 @@ export const load = async ({ params, depends, url, route, parent }) => { limit, query, search, - logs: await sdk.forProject.sites.listLogs(params.site, [ - Query.limit(limit), - Query.offset(offset), - Query.orderDesc(''), - ...parsedQueries.values() - ], search), - site, + logs: await sdk.forProject.sites.listLogs( + params.site, + [ + Query.limit(limit), + Query.offset(offset), + Query.orderDesc(''), + ...parsedQueries.values() + ], + search + ), + site }; };