Move member lookup to lib and remove duplicated types

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
leanderandClaude Opus 5.5 committed 2026-10-31 01:41:38 +01:00
1 parent 43d1091ab2
commit 7c37c4d6d5
6 files changed
+5 -18

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
"use client"; "use client";
import React, { createContext, useContext, useSyncExternalStore } from "react"; import React, { createContext, useContext, useSyncExternalStore } from "react";
type Language = "en" | "no"; export type Language = "en" | "no";
const LanguageContext = createContext<{ const LanguageContext = createContext<{
language: Language; language: Language;
+1 -1
View File
@@ -1,8 +1,8 @@
import { authOptions } from "@/lib/auth"; import { authOptions } from "@/lib/auth";
import { findDiscordMember } from "@/lib/members";
import type { Match } from "@/types"; import type { Match } from "@/types";
import { getServerSession } from "next-auth/next"; import { getServerSession } from "next-auth/next";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { findDiscordMember } from "./dataProvider";
export async function POST(request: Request) { export async function POST(request: Request) {
const session = await getServerSession(authOptions); const session = await getServerSession(authOptions);
+1 -1
View File
@@ -1,7 +1,7 @@
import { authOptions } from "@/lib/auth"; import { authOptions } from "@/lib/auth";
import { getPayingMemberCount } from "@/lib/members";
import { getServerSession } from "next-auth/next"; import { getServerSession } from "next-auth/next";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { getPayingMemberCount } from "../../guess/dataProvider";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
+1 -5
View File
@@ -1,13 +1,9 @@
"use client"; "use client";
import { useLanguage } from "@/LanguageContext"; import { type Language, useLanguage } from "@/LanguageContext";
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react"; import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
import { IoLanguage } from "react-icons/io5"; import { IoLanguage } from "react-icons/io5";
// Language type from context
type Language = "en" | "no";
// Language options configuration
const LANGUAGE_OPTIONS: Array<{ code: Language; label: string }> = [ const LANGUAGE_OPTIONS: Array<{ code: Language; label: string }> = [
{ code: "en", label: "English" }, { code: "en", label: "English" },
{ code: "no", label: "Norsk" }, { code: "no", label: "Norsk" },
+1 -10
View File
@@ -1,13 +1,4 @@
interface DiscordGuildMember { import type { DiscordGuildMember } from "@/types";
user: {
id: string;
username: string;
discriminator: string;
avatar: string | null;
};
roles: string[];
joined_at: string;
}
export async function verifyUserRole(userId: string): Promise<boolean> { export async function verifyUserRole(userId: string): Promise<boolean> {
const guildId = process.env.DISCORD_GUILD_ID; const guildId = process.env.DISCORD_GUILD_ID;
File renamed without changes.