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

Lint fixes across multiple files #4

Merged
merged 2 commits into from
Nov 10, 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
7 changes: 1 addition & 6 deletions apps/expo/src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ export function PostCard(
return (
<View className="flex flex-row rounded-lg bg-muted p-4">
<View className="flex-grow">
<Link
asChild
href={{
pathname: "/post/[id]",
}}
>
<Link asChild href="/">
<Pressable className="">
<Text className="text-xl font-semibold text-primary">Title</Text>
<Text className="mt-2 text-foreground">CONTENT</Text>
Expand Down
1 change: 1 addition & 0 deletions apps/nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vercel
11 changes: 8 additions & 3 deletions apps/nextjs/src/app/organizations/[org_slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ interface OrganizationDetailPageProps {
export async function generateMetadata(
props: Readonly<OrganizationDetailPageProps>,
) {
const params = await props.params;
const org = await getOrganization(params.org_slug);

const { org_slug } = await props.params;
let org;
try {
org = await getOrganization(org_slug);
} catch (error) {
console.error("Failed to fetch organization:", error);
org = null;
}
return { title: org?.name ?? "Organization" };
}

Expand Down
37 changes: 18 additions & 19 deletions apps/nextjs/src/app/players/players-table.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
"use client";

import type { Profile } from "@battle-stadium/db/schema";

import type { Key } from "react";

import Link from "next/link";

import type { Profile } from "@battle-stadium/db/schema";

export interface PlayersTableProps {
players: Profile[];
columns: { key: string; label: string }[];
}

export default function PlayersTable ({
export default function PlayersTable({
players,
columns,
}: Readonly<PlayersTableProps>) {

return (
<div className="h-90 w-90 flex flex-col items-center justify-center">
<h2>TODO: Players Table</h2>

<table className="table-auto">
<thead>
<tr>
{ columns.map(({ key, label }) => (
<th key={ key }>{ label }</th>
)) }
{columns.map(({ key, label }) => (
<th key={key}>{label}</th>
))}
</tr>
</thead>
<tbody>
{ players.map((player) => (
<tr key={ player.username }>
{ columns.map(({ key }) => (
<td key={ key }>{ renderCell(player, key as Key) }</td>
)) }
{players.map((player) => (
<tr key={player.username}>
{columns.map(({ key }) => (
<td key={key}>{renderCell(player, key as Key)}</td>
))}
</tr>
)) }
))}
</tbody>
</table>
</div>
);
}

function renderCell (row: Profile, columnKey: Key) {


function renderCell(row: Profile, columnKey: Key) {
switch (columnKey) {
case "username":
return (
<Link
prefetch={ true } className="text-primary" href={ `/players/${row.username}` }>
{ row.username }
prefetch={true}
className="text-primary"
href={`/players/${row.username}`}
>
{row.username}
</Link>
);
case "pronouns":
Expand Down
10 changes: 6 additions & 4 deletions apps/nextjs/src/app/server-actions/accounts/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

import { auth } from "@clerk/nextjs/server";

import { db, eq } from "@battle-stadium/db";
import type { Account } from "@battle-stadium/db/schema";
import { db, eq } from "@battle-stadium/db";
import { accounts, clerkUsers, profiles } from "@battle-stadium/db/schema";

export async function getAccounts () {
export async function getAccounts() {
return await db.query.accounts.findMany();
}

export async function getAccount (username: string): Promise<Account | null | undefined> {
export async function getAccount(
username: string,
): Promise<Account | null | undefined> {
const profile = await db.query.profiles.findFirst({
where: eq(profiles.username, username),
});
Expand All @@ -24,7 +26,7 @@ export async function getAccount (username: string): Promise<Account | null | un
});
}

export async function getAccountMe (): Promise<Account | null | undefined> {
export async function getAccountMe(): Promise<Account | null | undefined> {
const { userId } = await auth();

if (!userId) {
Expand Down
9 changes: 5 additions & 4 deletions apps/nextjs/src/app/server-actions/organizations/actions.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
"use server";

import type { Organization } from "@battle-stadium/db/schema";
import { eq } from "@battle-stadium/db";
import { db } from "@battle-stadium/db/client";
import { organizations } from "@battle-stadium/db/schema";
import type { Organization } from "@battle-stadium/db/schema";

export async function getOrganizations (): Promise<Organization[] | undefined> {
export async function getOrganizations(): Promise<Organization[]> {
const orgs = await db.query.organizations.findMany();
return orgs;
}

export async function getPartneredOrganizations (): Promise<Organization[] | undefined> {
export async function getPartneredOrganizations(): Promise<Organization[]> {
const orgs = await db.query.organizations.findMany({
where: eq(organizations.partner, true),
});

return orgs;
}

export async function getOrganization (slug: string): Promise<Organization | undefined> {
export async function getOrganization(slug: string) {
const org = await db.query.organizations.findFirst({
where: eq(organizations.slug, slug),
});
Expand Down
9 changes: 5 additions & 4 deletions apps/nextjs/src/app/server-actions/pokemon/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import type { FetchOptions } from "openapi-fetch";

import type { PokemonTeam } from "@battle-stadium/db/schema";
import { db } from "@battle-stadium/db";

import type { paths } from "~/lib/api/openapi-v1";
import type { PokePasteMetadata, ValidatedPokemon } from "~/lib/pokemon/common";
import { BattleStadiumApiClient, defaultConfig } from "~/lib/api";
import { db } from "@battle-stadium/db";
import type { PokemonTeam } from "@battle-stadium/db/schema";

interface PostPokemonTeamBody {
pokepaste_id?: string;
Expand All @@ -31,11 +32,11 @@ interface PostPokemonTeamBody {
}[];
}

export async function getPokemonTeams (): Promise<PokemonTeam[] | undefined> {
export async function getPokemonTeams(): Promise<PokemonTeam[] | undefined> {
return await db.query.pokemonTeams.findMany();
}

export async function postPokemonTeam (
export async function postPokemonTeam(
validatedTeam: ValidatedPokemon[],
metadata: PokePasteMetadata,
options?: FetchOptions<paths["/pokemon_teams"]["post"]>,
Expand Down
1 change: 0 additions & 1 deletion packages/db/src/schemas/friendly-id-slugs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ export const friendlyIdSlugs = pgTable(
};
},
);

1 change: 0 additions & 1 deletion packages/db/src/schemas/matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,5 @@ export const matches = pgTable(
},
);


export type Match = typeof matches.$inferSelect;
export type MatchInsert = typeof matches.$inferInsert;
6 changes: 4 additions & 2 deletions packages/db/src/schemas/organization-staff-members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ export const organizationStaffMembers = pgTable(
},
);

export type OrganizationStaffMember = typeof organizationStaffMembers.$inferSelect;
export type OrganizationStaffMemberInsert = typeof organizationStaffMembers.$inferInsert;
export type OrganizationStaffMember =
typeof organizationStaffMembers.$inferSelect;
export type OrganizationStaffMemberInsert =
typeof organizationStaffMembers.$inferInsert;
1 change: 1 addition & 0 deletions packages/db/src/schemas/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ export const organizations = pgTable(
);

export type Organization = typeof organizations.$inferSelect;

export type OrganizationInsert = typeof organizations.$inferInsert;
1 change: 0 additions & 1 deletion packages/db/src/schemas/players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,3 @@ export const players = pgTable(

export type Player = typeof players.$inferSelect;
export type PlayerInsert = typeof players.$inferInsert;

1 change: 0 additions & 1 deletion packages/db/src/schemas/rounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@ export const rounds = pgTable(
},
);


export type Round = typeof rounds.$inferSelect;
export type RoundInsert = typeof rounds.$inferInsert;