From 750af250c63a56b1495eabfa62f3f55562ddd418 Mon Sep 17 00:00:00 2001 From: Amandee Ellawala Date: Wed, 9 Oct 2024 23:33:55 +0100 Subject: [PATCH 1/2] [Local Only] Fix xata access --- .xatarc | 6 +-- src/xata.ts | 130 ++++++++++++++++++++++++++-------------------------- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/.xatarc b/.xatarc index 9ae9b7c..93c8e73 100644 --- a/.xatarc +++ b/.xatarc @@ -1,6 +1,6 @@ { - "databaseURL": "https://Usman-Sabuwala-s-workspace-u2kcvd.us-east-1.xata.sh/db/project-finder-hf", + "databaseURL": "https://Amandee-Manushika-s-workspace-d6c47s.us-east-1.xata.sh/db/amandee-db", "codegen": { - "output": "xata.ts" + "output": "src/xata.ts" } -} \ No newline at end of file +} diff --git a/src/xata.ts b/src/xata.ts index cb40f98..946a345 100644 --- a/src/xata.ts +++ b/src/xata.ts @@ -1,118 +1,118 @@ -// Generated by Xata Codegen 0.26.7. Please do not edit. -import { buildClient } from '@xata.io/client'; +// Generated by Xata Codegen 0.30.1. Please do not edit. +import { buildClient } from "@xata.io/client"; import type { BaseClientOptions, SchemaInference, - XataRecord -} from '@xata.io/client'; + XataRecord, +} from "@xata.io/client"; const tables = [ { - name: 'reports', + name: "reports", columns: [ - { name: 'repoId', type: 'int', unique: true }, - { name: 'repoAuthor', type: 'string' }, + { name: "repoId", type: "int", unique: true }, + { name: "repoAuthor", type: "string" }, { - name: 'message', - type: 'text', + name: "message", + type: "text", notNull: true, - defaultValue: 'No Message' + defaultValue: "No Message", }, - { name: 'user', type: 'link', link: { table: 'nextauth_users' } }, - { name: 'valid', type: 'bool', notNull: true, defaultValue: 'true' }, - { name: 'repoUrl', type: 'string', unique: true } - ] + { name: "user", type: "link", link: { table: "nextauth_users" } }, + { name: "valid", type: "bool", notNull: true, defaultValue: "true" }, + { name: "repoUrl", type: "string", unique: true }, + ], }, { - name: 'nextauth_users', + name: "nextauth_users", columns: [ - { name: 'email', type: 'email' }, - { name: 'emailVerified', type: 'datetime' }, - { name: 'name', type: 'string' }, - { name: 'image', type: 'string' } + { name: "email", type: "email" }, + { name: "emailVerified", type: "datetime" }, + { name: "name", type: "string" }, + { name: "image", type: "string" }, ], revLinks: [ - { column: 'user', table: 'nextauth_accounts' }, - { column: 'user', table: 'nextauth_users_accounts' }, - { column: 'user', table: 'nextauth_users_sessions' }, - { column: 'user', table: 'nextauth_sessions' }, - { column: 'user', table: 'reports' } - ] + { column: "user", table: "nextauth_accounts" }, + { column: "user", table: "nextauth_users_accounts" }, + { column: "user", table: "nextauth_users_sessions" }, + { column: "user", table: "nextauth_sessions" }, + { column: "user", table: "reports" }, + ], }, { - name: 'nextauth_accounts', + name: "nextauth_accounts", columns: [ - { name: 'user', type: 'link', link: { table: 'nextauth_users' } }, - { name: 'type', type: 'string' }, - { name: 'provider', type: 'string' }, - { name: 'providerAccountId', type: 'string' }, - { name: 'refresh_token', type: 'string' }, - { name: 'access_token', type: 'string' }, - { name: 'expires_at', type: 'int' }, - { name: 'token_type', type: 'string' }, - { name: 'scope', type: 'string' }, - { name: 'id_token', type: 'text' }, - { name: 'session_state', type: 'string' } + { name: "user", type: "link", link: { table: "nextauth_users" } }, + { name: "type", type: "string" }, + { name: "provider", type: "string" }, + { name: "providerAccountId", type: "string" }, + { name: "refresh_token", type: "string" }, + { name: "access_token", type: "string" }, + { name: "expires_at", type: "int" }, + { name: "token_type", type: "string" }, + { name: "scope", type: "string" }, + { name: "id_token", type: "text" }, + { name: "session_state", type: "string" }, ], - revLinks: [{ column: 'account', table: 'nextauth_users_accounts' }] + revLinks: [{ column: "account", table: "nextauth_users_accounts" }], }, { - name: 'nextauth_verificationTokens', + name: "nextauth_verificationTokens", columns: [ - { name: 'identifier', type: 'string' }, - { name: 'token', type: 'string' }, - { name: 'expires', type: 'datetime' } - ] + { name: "identifier", type: "string" }, + { name: "token", type: "string" }, + { name: "expires", type: "datetime" }, + ], }, { - name: 'nextauth_users_accounts', + name: "nextauth_users_accounts", columns: [ - { name: 'user', type: 'link', link: { table: 'nextauth_users' } }, - { name: 'account', type: 'link', link: { table: 'nextauth_accounts' } } - ] + { name: "user", type: "link", link: { table: "nextauth_users" } }, + { name: "account", type: "link", link: { table: "nextauth_accounts" } }, + ], }, { - name: 'nextauth_users_sessions', + name: "nextauth_users_sessions", columns: [ - { name: 'user', type: 'link', link: { table: 'nextauth_users' } }, - { name: 'session', type: 'link', link: { table: 'nextauth_sessions' } } - ] + { name: "user", type: "link", link: { table: "nextauth_users" } }, + { name: "session", type: "link", link: { table: "nextauth_sessions" } }, + ], }, { - name: 'nextauth_sessions', + name: "nextauth_sessions", columns: [ - { name: 'sessionToken', type: 'string' }, - { name: 'expires', type: 'datetime' }, - { name: 'user', type: 'link', link: { table: 'nextauth_users' } } + { name: "sessionToken", type: "string" }, + { name: "expires", type: "datetime" }, + { name: "user", type: "link", link: { table: "nextauth_users" } }, ], - revLinks: [{ column: 'session', table: 'nextauth_users_sessions' }] - } + revLinks: [{ column: "session", table: "nextauth_users_sessions" }], + }, ] as const; export type SchemaTables = typeof tables; export type InferredTypes = SchemaInference; -export type Reports = InferredTypes['reports']; +export type Reports = InferredTypes["reports"]; export type ReportsRecord = Reports & XataRecord; -export type NextauthUsers = InferredTypes['nextauth_users']; +export type NextauthUsers = InferredTypes["nextauth_users"]; export type NextauthUsersRecord = NextauthUsers & XataRecord; -export type NextauthAccounts = InferredTypes['nextauth_accounts']; +export type NextauthAccounts = InferredTypes["nextauth_accounts"]; export type NextauthAccountsRecord = NextauthAccounts & XataRecord; export type NextauthVerificationTokens = - InferredTypes['nextauth_verificationTokens']; + InferredTypes["nextauth_verificationTokens"]; export type NextauthVerificationTokensRecord = NextauthVerificationTokens & XataRecord; -export type NextauthUsersAccounts = InferredTypes['nextauth_users_accounts']; +export type NextauthUsersAccounts = InferredTypes["nextauth_users_accounts"]; export type NextauthUsersAccountsRecord = NextauthUsersAccounts & XataRecord; -export type NextauthUsersSessions = InferredTypes['nextauth_users_sessions']; +export type NextauthUsersSessions = InferredTypes["nextauth_users_sessions"]; export type NextauthUsersSessionsRecord = NextauthUsersSessions & XataRecord; -export type NextauthSessions = InferredTypes['nextauth_sessions']; +export type NextauthSessions = InferredTypes["nextauth_sessions"]; export type NextauthSessionsRecord = NextauthSessions & XataRecord; export type DatabaseSchema = { @@ -129,7 +129,7 @@ const DatabaseClient = buildClient(); const defaultOptions = { databaseURL: - 'https://Usman-Sabuwala-s-workspace-u2kcvd.us-east-1.xata.sh/db/project-finder-hf' + "https://Amandee-Manushika-s-workspace-d6c47s.us-east-1.xata.sh/db/amandee-db", }; export class XataClient extends DatabaseClient { From 720e0870e1a4ddce2ddc3258bb1592e348b3a554 Mon Sep 17 00:00:00 2001 From: Amandee Ellawala Date: Sat, 12 Oct 2024 14:53:00 +0100 Subject: [PATCH 2/2] Fix #223 prevent resetting star range and sort order when selecting a language --- src/app/(public)/repos/[language]/_components/sorter.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/(public)/repos/[language]/_components/sorter.tsx b/src/app/(public)/repos/[language]/_components/sorter.tsx index aa5e9b3..52ba306 100644 --- a/src/app/(public)/repos/[language]/_components/sorter.tsx +++ b/src/app/(public)/repos/[language]/_components/sorter.tsx @@ -23,6 +23,7 @@ enum SortTypes { export function Sorter() { const searchParams = useSearchParams(); const pathname = usePathname(); + const urlSearchParam = new URLSearchParams(searchParams); const navigationItems = [ { @@ -129,7 +130,7 @@ export function Sorter() {
    {mainLanguages.sort(sortByName).map(language => (
  • - + {language}
  • @@ -148,7 +149,7 @@ export function Sorter() {
      {navigationItems.map((item, index) => { - const sp = item.onSelect(new URLSearchParams(searchParams)); + const sp = item.onSelect(urlSearchParam); if (item.name === SortTypes.BestMatch) { sp.delete('o'); sp.delete('s');