Improvements: remove dead config, fix ESM, add URL validation, unify types, add missing logging
- Remove .prettierrc (dead config, Biome replaces Prettier) - Rename lighthouserc.json to lighthouserc.cjs with module.exports for ESM compat - Add logger.warn to empty catch blocks in auth, register, site-settings, prisma-cache, redis, security, rate-limit - Unify ActionResult type: action-helper.ts uses 'ok' consistent with safe-action-shared.ts - Add noUnusedLocals + noUnusedParameters to tsconfig + fix 25 pre-existing unused vars - Replace barrel export src/types/index.ts with direct @/types/common imports - Make trustHost conditional (development only) in auth.ts - Add pre-flight URL validation to update-Nitrov3.sh to catch image.library.url misconfigurations - Improve NITRO_IMAGE_LIBRARY_URL content validation in pre-flight & post-compute checks
This commit is contained in:
1 parent
b922f6d49f
commit
17847545dd
292 files changed
+69195
-67915
No files matched your search
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"semi": true,
|
|
||||||
"singleQuote": false,
|
|
||||||
"tabWidth": 2,
|
|
||||||
"trailingComma": "all",
|
|
||||||
"printWidth": 110,
|
|
||||||
"arrowParens": "always",
|
|
||||||
"endOfLine": "lf"
|
|
||||||
}
|
|
||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"includes": ["**", "!setup", "!public"]
|
"includes": ["**", "!setup", "!public", "!*.cjs"]
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
+7
-7
@@ -1,16 +1,16 @@
|
|||||||
import { test, expect } from "@playwright/test";
|
import { expect, test } from "@playwright/test";
|
||||||
|
|
||||||
test("homepage has title", async ({ page }) => {
|
test("homepage has title", async ({ page }) => {
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await expect(page).toHaveTitle(/Magic Hotel|Atom/i);
|
await expect(page).toHaveTitle(/Magic Hotel|Atom/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("register page loads", async ({ page }) => {
|
test("register page loads", async ({ page }) => {
|
||||||
await page.goto("/register");
|
await page.goto("/register");
|
||||||
await expect(page).toHaveTitle(/registreer|register|konto/i);
|
await expect(page).toHaveTitle(/registreer|register|konto/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("login page loads", async ({ page }) => {
|
test("login page loads", async ({ page }) => {
|
||||||
await page.goto("/login");
|
await page.goto("/login");
|
||||||
await expect(page).toHaveTitle(/inloggen|login/i);
|
await expect(page).toHaveTitle(/inloggen|login/i);
|
||||||
});
|
});
|
||||||
+15
-15
@@ -3,19 +3,19 @@ import unusedImports from "eslint-plugin-unused-imports";
|
|||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{
|
{
|
||||||
ignores: ["node_modules", ".next", "dist", "build"],
|
ignores: ["node_modules", ".next", "dist", "build"],
|
||||||
},
|
},
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
tseslint.configs.recommended,
|
tseslint.configs.recommended,
|
||||||
{
|
{
|
||||||
files: ["src/**/*.{ts,tsx}", "pages/**/*.{ts,tsx}", "app/**/*.{ts,tsx}"],
|
files: ["src/**/*.{ts,tsx}", "pages/**/*.{ts,tsx}", "app/**/*.{ts,tsx}"],
|
||||||
plugins: {
|
plugins: {
|
||||||
"unused-imports": unusedImports,
|
"unused-imports": unusedImports,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"unused-imports/no-unused-vars": "error",
|
"unused-imports/no-unused-vars": "error",
|
||||||
"no-console": "warn",
|
"no-console": "warn",
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
File renamed without changes.
+19
-17
@@ -1,7 +1,7 @@
|
|||||||
import type { NextConfig } from "next";
|
|
||||||
import { withSentryConfig } from "@sentry/nextjs";
|
|
||||||
import createNextIntlPlugin from "next-intl/plugin";
|
|
||||||
import withBundleAnalyzer from "@next/bundle-analyzer";
|
import withBundleAnalyzer from "@next/bundle-analyzer";
|
||||||
|
import { withSentryConfig } from "@sentry/nextjs";
|
||||||
|
import type { NextConfig } from "next";
|
||||||
|
import createNextIntlPlugin from "next-intl/plugin";
|
||||||
|
|
||||||
const securityHeaders = [
|
const securityHeaders = [
|
||||||
{ key: "X-DNS-Prefetch-Control", value: "on" },
|
{ key: "X-DNS-Prefetch-Control", value: "on" },
|
||||||
@@ -79,17 +79,19 @@ const withBA = withBundleAnalyzer({
|
|||||||
enabled: process.env.ANALYZE === "true",
|
enabled: process.env.ANALYZE === "true",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withBA(withSentryConfig(config, {
|
export default withBA(
|
||||||
org: process.env.SENTRY_ORG,
|
withSentryConfig(config, {
|
||||||
project: process.env.SENTRY_PROJECT,
|
org: process.env.SENTRY_ORG,
|
||||||
authToken: sentryAuthToken,
|
project: process.env.SENTRY_PROJECT,
|
||||||
silent: !process.env.CI,
|
authToken: sentryAuthToken,
|
||||||
widenClientFileUpload: true,
|
silent: !process.env.CI,
|
||||||
sourcemaps: {
|
widenClientFileUpload: true,
|
||||||
disable: !sentryAuthToken,
|
sourcemaps: {
|
||||||
},
|
disable: !sentryAuthToken,
|
||||||
release: {
|
},
|
||||||
create: Boolean(sentryAuthToken),
|
release: {
|
||||||
},
|
create: Boolean(sentryAuthToken),
|
||||||
telemetry: false,
|
},
|
||||||
}));
|
telemetry: false,
|
||||||
|
}),
|
||||||
|
);
|
||||||
+29
-29
@@ -1,33 +1,33 @@
|
|||||||
import { defineConfig, devices } from "@playwright/test";
|
import { defineConfig, devices } from "@playwright/test";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: "./e2e",
|
testDir: "./e2e",
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
retries: process.env.CI ? 2 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
workers: process.env.CI ? 1 : undefined,
|
workers: process.env.CI ? 1 : undefined,
|
||||||
reporter: "html",
|
reporter: "html",
|
||||||
use: {
|
use: {
|
||||||
baseURL: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
|
baseURL: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
|
||||||
trace: "on-first-retry",
|
trace: "on-first-retry",
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: "chromium",
|
name: "chromium",
|
||||||
use: { ...devices["Desktop Chrome"] },
|
use: { ...devices["Desktop Chrome"] },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "firefox",
|
name: "firefox",
|
||||||
use: { ...devices["Desktop Firefox"] },
|
use: { ...devices["Desktop Firefox"] },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "webkit",
|
name: "webkit",
|
||||||
use: { ...devices["Desktop Safari"] },
|
use: { ...devices["Desktop Safari"] },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
webServer: {
|
webServer: {
|
||||||
command: "pnpm dev",
|
command: "pnpm dev",
|
||||||
url: "http://localhost:3000",
|
url: "http://localhost:3000",
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -29,6 +29,7 @@ async function openConnection() {
|
|||||||
const mysql = await import("mysql2/promise");
|
const mysql = await import("mysql2/promise");
|
||||||
return mysql.createConnection(url);
|
return mysql.createConnection(url);
|
||||||
}
|
}
|
||||||
|
void openConnection;
|
||||||
|
|
||||||
async function createTrackingTable(
|
async function createTrackingTable(
|
||||||
conn: import("mysql2/promise").Connection,
|
conn: import("mysql2/promise").Connection,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { redirect } from "next/navigation";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { formPositiveBigInt } from "@/lib/form-data";
|
import { formPositiveBigInt } from "@/lib/form-data";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
import { PERMS } from "@/lib/permissions";
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { adminAction } from "@/lib/safe-action";
|
import { adminAction } from "@/lib/safe-action";
|
||||||
import { ActionError, actionOk } from "@/lib/safe-action-shared";
|
import { ActionError, actionOk } from "@/lib/safe-action-shared";
|
||||||
import { logger } from "@/lib/logger";
|
|
||||||
import { logStaffActivity } from "@/lib/services/staff-activity";
|
import { logStaffActivity } from "@/lib/services/staff-activity";
|
||||||
|
|
||||||
// CRUD for website advertisements (website_ads). Emulator does not own this
|
// CRUD for website advertisements (website_ads). Emulator does not own this
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { formPositiveBigInt } from "@/lib/form-data";
|
import { formPositiveBigInt } from "@/lib/form-data";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export async function dismissApplication(formData: FormData): Promise<void> {
|
export async function dismissApplication(formData: FormData): Promise<void> {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { slugify } from "@/lib/format";
|
import { slugify } from "@/lib/format";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
async function uniqueSlug(title: string): Promise<string> {
|
async function uniqueSlug(title: string): Promise<string> {
|
||||||
@@ -74,9 +74,7 @@ export async function updateArticle(formData: FormData): Promise<void> {
|
|||||||
.normalize("NFC")
|
.normalize("NFC")
|
||||||
.trim()
|
.trim()
|
||||||
.slice(0, 255),
|
.slice(0, 255),
|
||||||
...(rawSlug
|
...(rawSlug ? { slug: await uniqueSlug(rawSlug) } : {}),
|
||||||
? { slug: await uniqueSlug(rawSlug) }
|
|
||||||
: {}),
|
|
||||||
shortStory: String(formData.get("shortStory") ?? "")
|
shortStory: String(formData.get("shortStory") ?? "")
|
||||||
.normalize("NFC")
|
.normalize("NFC")
|
||||||
.trim()
|
.trim()
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { formPositiveBigInt } from "@/lib/form-data";
|
import { formPositiveBigInt } from "@/lib/form-data";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export async function createEmailTemplate(formData: FormData): Promise<void> {
|
export async function createEmailTemplate(formData: FormData): Promise<void> {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { formPositiveBigInt } from "@/lib/form-data";
|
import { formPositiveBigInt } from "@/lib/form-data";
|
||||||
import { canonicalize, sanitizeField } from "@/lib/foundation/security";
|
import { canonicalize, sanitizeField } from "@/lib/foundation/security";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { logStaffActivity } from "@/lib/services/staff-activity";
|
import { logStaffActivity } from "@/lib/services/staff-activity";
|
||||||
|
|
||||||
@@ -26,8 +26,10 @@ export async function createHelpQuestion(formData: FormData): Promise<void> {
|
|||||||
const imageUrl = sanitizeField(formData.get("imageUrl"));
|
const imageUrl = sanitizeField(formData.get("imageUrl"));
|
||||||
const buttonText = sanitizeField(formData.get("buttonText"));
|
const buttonText = sanitizeField(formData.get("buttonText"));
|
||||||
const buttonUrl = sanitizeField(formData.get("buttonUrl"));
|
const buttonUrl = sanitizeField(formData.get("buttonUrl"));
|
||||||
const buttonColor = sanitizeField(formData.get("buttonColor"), 16) || "#eeb425";
|
const buttonColor =
|
||||||
const buttonBorderColor = sanitizeField(formData.get("buttonBorderColor"), 16) || "#facc15";
|
sanitizeField(formData.get("buttonColor"), 16) || "#eeb425";
|
||||||
|
const buttonBorderColor =
|
||||||
|
sanitizeField(formData.get("buttonBorderColor"), 16) || "#facc15";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const entry = await prisma.websiteHelpCenterCategories.create({
|
const entry = await prisma.websiteHelpCenterCategories.create({
|
||||||
@@ -73,8 +75,10 @@ export async function updateHelpQuestion(formData: FormData): Promise<void> {
|
|||||||
const imageUrl = sanitizeField(formData.get("imageUrl"));
|
const imageUrl = sanitizeField(formData.get("imageUrl"));
|
||||||
const buttonText = sanitizeField(formData.get("buttonText"));
|
const buttonText = sanitizeField(formData.get("buttonText"));
|
||||||
const buttonUrl = sanitizeField(formData.get("buttonUrl"));
|
const buttonUrl = sanitizeField(formData.get("buttonUrl"));
|
||||||
const buttonColor = sanitizeField(formData.get("buttonColor"), 16) || "#eeb425";
|
const buttonColor =
|
||||||
const buttonBorderColor = sanitizeField(formData.get("buttonBorderColor"), 16) || "#facc15";
|
sanitizeField(formData.get("buttonColor"), 16) || "#eeb425";
|
||||||
|
const buttonBorderColor =
|
||||||
|
sanitizeField(formData.get("buttonBorderColor"), 16) || "#facc15";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await prisma.websiteHelpCenterCategories.update({
|
await prisma.websiteHelpCenterCategories.update({
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { mkdir, writeFile } from "node:fs/promises";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { MEDIA_ROOT, resolveMediaPath } from "@/lib/media-storage";
|
import { MEDIA_ROOT, resolveMediaPath } from "@/lib/media-storage";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
|
|
||||||
const MAX_SIZE = 5 * 1024 * 1024; // 5MB
|
const MAX_SIZE = 5 * 1024 * 1024; // 5MB
|
||||||
const ALLOWED = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
const ALLOWED = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
||||||
@@ -19,7 +19,10 @@ export async function uploadMedia(
|
|||||||
if (file.size > MAX_SIZE)
|
if (file.size > MAX_SIZE)
|
||||||
return { ok: false, error: "File too large (max 5MB)" };
|
return { ok: false, error: "File too large (max 5MB)" };
|
||||||
if (!ALLOWED.includes(file.type))
|
if (!ALLOWED.includes(file.type))
|
||||||
return { ok: false, error: "Invalid file type. Allowed: PNG, JPEG, GIF, WebP" };
|
return {
|
||||||
|
ok: false,
|
||||||
|
error: "Invalid file type. Allowed: PNG, JPEG, GIF, WebP",
|
||||||
|
};
|
||||||
|
|
||||||
const baseDir = MEDIA_ROOT;
|
const baseDir = MEDIA_ROOT;
|
||||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { formPositiveBigInt } from "@/lib/form-data";
|
import { formPositiveBigInt } from "@/lib/form-data";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export async function createCategory(formData: FormData): Promise<void> {
|
export async function createCategory(formData: FormData): Promise<void> {
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import {
|
|||||||
} from "@/lib/habbo-gamedata-hotel";
|
} from "@/lib/habbo-gamedata-hotel";
|
||||||
import { PERMS } from "@/lib/permissions";
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { clearBadgeCache } from "@/lib/services/habboassets";
|
|
||||||
import { clearHabboItCache } from "@/lib/services/habbo-furnidata-cache";
|
import { clearHabboItCache } from "@/lib/services/habbo-furnidata-cache";
|
||||||
|
import { clearBadgeCache } from "@/lib/services/habboassets";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
|
|
||||||
const managedKeySet = new Set(MANAGED_SETTING_KEYS);
|
const managedKeySet = new Set(MANAGED_SETTING_KEYS);
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { formPositiveBigInt } from "@/lib/form-data";
|
import { formPositiveBigInt } from "@/lib/form-data";
|
||||||
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { logServerError } from "@/lib/server-log";
|
import { logServerError } from "@/lib/server-log";
|
||||||
import { logStaffActivity } from "@/lib/services/staff-activity";
|
import { logStaffActivity } from "@/lib/services/staff-activity";
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { PERMS } from "@/lib/permissions";
|
|||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
import { logStaffActivity } from "@/lib/services/staff-activity";
|
import { logStaffActivity } from "@/lib/services/staff-activity";
|
||||||
|
import { ensureReadableThemeColors } from "@/lib/theme-contrast";
|
||||||
import {
|
import {
|
||||||
deleteCustomThemeStore,
|
deleteCustomThemeStore,
|
||||||
getCustomTheme,
|
getCustomTheme,
|
||||||
@@ -15,7 +16,6 @@ import {
|
|||||||
} from "@/lib/theme-custom-store";
|
} from "@/lib/theme-custom-store";
|
||||||
import { FONTS, PRESETS, THEME_COLOR_KEYS } from "@/lib/theme-presets";
|
import { FONTS, PRESETS, THEME_COLOR_KEYS } from "@/lib/theme-presets";
|
||||||
import { presetSettings, settingKey } from "@/lib/theme-settings";
|
import { presetSettings, settingKey } from "@/lib/theme-settings";
|
||||||
import { ensureReadableThemeColors } from "@/lib/theme-contrast";
|
|
||||||
|
|
||||||
// Only hex/keyword colour values are accepted (matches ThemeVars' sanitiser).
|
// Only hex/keyword colour values are accepted (matches ThemeVars' sanitiser).
|
||||||
const COLOR_RE = /^[#a-zA-Z0-9(),.\s%-]+$/;
|
const COLOR_RE = /^[#a-zA-Z0-9(),.\s%-]+$/;
|
||||||
@@ -46,7 +46,10 @@ export async function saveTheme(formData: FormData): Promise<void> {
|
|||||||
}
|
}
|
||||||
const fixed = ensureReadableThemeColors(bag);
|
const fixed = ensureReadableThemeColors(bag);
|
||||||
for (const [key, value] of Object.entries(fixed)) {
|
for (const [key, value] of Object.entries(fixed)) {
|
||||||
await writeSetting(settingKey(key as (typeof THEME_COLOR_KEYS)[number], mode), value);
|
await writeSetting(
|
||||||
|
settingKey(key as (typeof THEME_COLOR_KEYS)[number], mode),
|
||||||
|
value,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const ADMIN_KEYS = [
|
const ADMIN_KEYS = [
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { positiveBigInt } from "@/lib/api";
|
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
import { requirePermission } from "@/lib/admin/guard";
|
||||||
|
import { positiveBigInt } from "@/lib/api";
|
||||||
import { PERMS } from "@/lib/permissions";
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import {
|
import {
|
||||||
|
type ActionResult,
|
||||||
actionError,
|
actionError,
|
||||||
actionOk,
|
actionOk,
|
||||||
type ActionResult,
|
|
||||||
} from "@/lib/safe-action-shared";
|
} from "@/lib/safe-action-shared";
|
||||||
import { logServerError } from "@/lib/server-log";
|
import { logServerError } from "@/lib/server-log";
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { requirePermission } from "@/lib/admin/guard";
|
|||||||
import { PERMS } from "@/lib/permissions";
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import {
|
import {
|
||||||
|
type ActionResult,
|
||||||
actionError,
|
actionError,
|
||||||
actionOk,
|
actionOk,
|
||||||
type ActionResult,
|
|
||||||
} from "@/lib/safe-action-shared";
|
} from "@/lib/safe-action-shared";
|
||||||
import { reloadWordFilter } from "@/lib/services/moderation";
|
import { reloadWordFilter } from "@/lib/services/moderation";
|
||||||
import { rcon } from "@/lib/services/rcon";
|
import { rcon } from "@/lib/services/rcon";
|
||||||
@@ -33,9 +33,7 @@ export async function addWord(input: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteWord(input: {
|
export async function deleteWord(input: { id: string }): Promise<ActionResult> {
|
||||||
id: string;
|
|
||||||
}): Promise<ActionResult> {
|
|
||||||
await requirePermission(PERMS.WORDFILTER_EDIT);
|
await requirePermission(PERMS.WORDFILTER_EDIT);
|
||||||
const raw = String(input.id ?? "").normalize("NFC");
|
const raw = String(input.id ?? "").normalize("NFC");
|
||||||
if (!raw) return actionError("Missing word id");
|
if (!raw) return actionError("Missing word id");
|
||||||
|
|||||||
+50
-48
File diff suppressed because it is too large.
Load diff
@@ -53,9 +53,9 @@ describe("email verification tokens", () => {
|
|||||||
|
|
||||||
it("rejects legacy forever-valid digests", async () => {
|
it("rejects legacy forever-valid digests", async () => {
|
||||||
const legacy = "a".repeat(64);
|
const legacy = "a".repeat(64);
|
||||||
expect(
|
expect(await isValidVerificationToken("[email protected]", legacy)).toBe(
|
||||||
await isValidVerificationToken("[email protected]", legacy),
|
false,
|
||||||
).toBe(false);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("rejects expired tokens", async () => {
|
it("rejects expired tokens", async () => {
|
||||||
@@ -69,18 +69,19 @@ describe("email verification tokens", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("sends mail with a verify link", async () => {
|
it("sends mail with a verify link", async () => {
|
||||||
mockGetTranslations.mockResolvedValue(
|
mockGetTranslations.mockResolvedValue(((
|
||||||
((key: string, values?: { hotel?: string }) => {
|
key: string,
|
||||||
const map: Record<string, string> = {
|
values?: { hotel?: string },
|
||||||
subject: `Verify your email · ${values?.hotel}`,
|
) => {
|
||||||
heading: "Verify your email",
|
const map: Record<string, string> = {
|
||||||
body: `Welcome to ${values?.hotel}!`,
|
subject: `Verify your email · ${values?.hotel}`,
|
||||||
button: "Verify email",
|
heading: "Verify your email",
|
||||||
fallback: "Paste this link:",
|
body: `Welcome to ${values?.hotel}!`,
|
||||||
};
|
button: "Verify email",
|
||||||
return map[key] ?? key;
|
fallback: "Paste this link:",
|
||||||
}) as never,
|
};
|
||||||
);
|
return map[key] ?? key;
|
||||||
|
}) as never);
|
||||||
|
|
||||||
await sendVerification("[email protected]");
|
await sendVerification("[email protected]");
|
||||||
expect(mockSendMail).toHaveBeenCalledWith(
|
expect(mockSendMail).toHaveBeenCalledWith(
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import { positiveBigInt } from "@/lib/api";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { clientIp, rateLimit } from "@/lib/rate-limit";
|
import { clientIp, rateLimit } from "@/lib/rate-limit";
|
||||||
import { positiveBigInt } from "@/lib/api";
|
|
||||||
import { moderateOrThrow } from "@/lib/services/moderation";
|
import { moderateOrThrow } from "@/lib/services/moderation";
|
||||||
import { createOwnedTicketReply } from "@/lib/services/ticket-replies";
|
import { createOwnedTicketReply } from "@/lib/services/ticket-replies";
|
||||||
|
|
||||||
|
|||||||
+96
-92
File diff suppressed because it is too large.
Load diff
@@ -12,11 +12,7 @@ const NAME_MAX = 255;
|
|||||||
const TEXT_MAX = 5000;
|
const TEXT_MAX = 5000;
|
||||||
const STYLE_MAX = 5000;
|
const STYLE_MAX = 5000;
|
||||||
|
|
||||||
type ApplyOutcome =
|
type ApplyOutcome = "submitted" | "invalid" | "ratelimit" | "error";
|
||||||
| "submitted"
|
|
||||||
| "invalid"
|
|
||||||
| "ratelimit"
|
|
||||||
| "error";
|
|
||||||
|
|
||||||
function applyRedirect(outcome: ApplyOutcome): never {
|
function applyRedirect(outcome: ApplyOutcome): never {
|
||||||
if (outcome === "submitted") redirect("/radio/apply?submitted=1");
|
if (outcome === "submitted") redirect("/radio/apply?submitted=1");
|
||||||
|
|||||||
@@ -9,12 +9,7 @@ import { clientIp, rateLimit } from "@/lib/rate-limit";
|
|||||||
const SONG_MAX = 255;
|
const SONG_MAX = 255;
|
||||||
const ARTIST_MAX = 255;
|
const ARTIST_MAX = 255;
|
||||||
|
|
||||||
type RequestOutcome =
|
type RequestOutcome = "posted" | "empty" | "invalid" | "ratelimit" | "error";
|
||||||
| "posted"
|
|
||||||
| "empty"
|
|
||||||
| "invalid"
|
|
||||||
| "ratelimit"
|
|
||||||
| "error";
|
|
||||||
|
|
||||||
function requestsRedirect(outcome: RequestOutcome): never {
|
function requestsRedirect(outcome: RequestOutcome): never {
|
||||||
if (outcome === "posted") redirect("/radio/requests?posted=1");
|
if (outcome === "posted") redirect("/radio/requests?posted=1");
|
||||||
|
|||||||
@@ -12,12 +12,7 @@ const shoutSchema = z.object({
|
|||||||
message: z.string().min(1, "Message is required").max(255),
|
message: z.string().min(1, "Message is required").max(255),
|
||||||
});
|
});
|
||||||
|
|
||||||
type ShoutOutcome =
|
type ShoutOutcome = "posted" | "invalid" | "moderated" | "ratelimit" | "error";
|
||||||
| "posted"
|
|
||||||
| "invalid"
|
|
||||||
| "moderated"
|
|
||||||
| "ratelimit"
|
|
||||||
| "error";
|
|
||||||
|
|
||||||
function shoutsRedirect(outcome: ShoutOutcome): never {
|
function shoutsRedirect(outcome: ShoutOutcome): never {
|
||||||
if (outcome === "posted") redirect("/radio/shouts?posted=1");
|
if (outcome === "posted") redirect("/radio/shouts?posted=1");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { redirect } from "next/navigation";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { sendVerification } from "@/actions/email-verify";
|
import { sendVerification } from "@/actions/email-verify";
|
||||||
import { hashPassword } from "@/lib/auth/password";
|
import { hashPassword } from "@/lib/auth/password";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { clientIp, rateLimit } from "@/lib/rate-limit";
|
import { clientIp, rateLimit } from "@/lib/rate-limit";
|
||||||
import { captchaConfig, verifyCaptcha } from "@/lib/services/captcha";
|
import { captchaConfig, verifyCaptcha } from "@/lib/services/captcha";
|
||||||
@@ -100,6 +101,7 @@ export async function register(
|
|||||||
});
|
});
|
||||||
if (existing) return "That username is already taken";
|
if (existing) return "That username is already taken";
|
||||||
} catch {
|
} catch {
|
||||||
|
logger.warn("Username uniqueness check failed during registration");
|
||||||
return "Registration is temporarily unavailable";
|
return "Registration is temporarily unavailable";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,10 +124,11 @@ export async function register(
|
|||||||
try {
|
try {
|
||||||
await sendVerification(mail);
|
await sendVerification(mail);
|
||||||
} catch {
|
} catch {
|
||||||
// No-op: account is created; user can request a new link later.
|
logger.warn("Failed to send verification email after registration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
logger.warn("Account creation failed");
|
||||||
return "Could not create the account (is the username unique?)";
|
return "Could not create the account (is the username unique?)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { mkdir, unlink, writeFile } from "node:fs/promises";
|
import { mkdir, unlink, writeFile } from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
import { resolveMediaPath } from "@/lib/media-storage";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
import { resolveMediaPath } from "@/lib/media-storage";
|
|
||||||
|
|
||||||
const FAVICON_DIR = resolveMediaPath("favicon");
|
const FAVICON_DIR = resolveMediaPath("favicon");
|
||||||
const MAX_SIZE = 2 * 1024 * 1024; // 2MB
|
const MAX_SIZE = 2 * 1024 * 1024; // 2MB
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { mkdir, writeFile } from "node:fs/promises";
|
import { mkdir, writeFile } from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
import { resolveMediaPath } from "@/lib/media-storage";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
import { resolveMediaPath } from "@/lib/media-storage";
|
|
||||||
|
|
||||||
const MEDIA_DIR = resolveMediaPath("logo");
|
const MEDIA_DIR = resolveMediaPath("logo");
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,13 @@ export async function signOutEverywhere(): Promise<void> {
|
|||||||
where: personalTokenScope(userId),
|
where: personalTokenScope(userId),
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.warn("Failed to revoke personal access tokens during sign-out-everywhere", {
|
logger.warn(
|
||||||
userId,
|
"Failed to revoke personal access tokens during sign-out-everywhere",
|
||||||
error: err instanceof Error ? err.message : "Unknown",
|
{
|
||||||
});
|
userId,
|
||||||
|
error: err instanceof Error ? err.message : "Unknown",
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await signOut({ redirectTo: "/login?signedOutAll=1" });
|
await signOut({ redirectTo: "/login?signedOutAll=1" });
|
||||||
|
|||||||
+1
-6
@@ -28,12 +28,7 @@ function parseBadgeCodes(raw: string | null | undefined): string[] {
|
|||||||
.filter((s) => s.length > 0 && s.length <= 32);
|
.filter((s) => s.length > 0 && s.length <= 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
type BuyOutcome =
|
type BuyOutcome = "bought" | "invalid" | "credits" | "ratelimit" | "error";
|
||||||
| "bought"
|
|
||||||
| "invalid"
|
|
||||||
| "credits"
|
|
||||||
| "ratelimit"
|
|
||||||
| "error";
|
|
||||||
|
|
||||||
function shopRedirect(
|
function shopRedirect(
|
||||||
categoryId: string,
|
categoryId: string,
|
||||||
|
|||||||
@@ -22,12 +22,7 @@ type FriendRequestOutcome =
|
|||||||
| "ratelimit"
|
| "ratelimit"
|
||||||
| "error";
|
| "error";
|
||||||
|
|
||||||
type ThreadOutcome =
|
type ThreadOutcome = "posted" | "invalid" | "not_found" | "ratelimit" | "error";
|
||||||
| "posted"
|
|
||||||
| "invalid"
|
|
||||||
| "not_found"
|
|
||||||
| "ratelimit"
|
|
||||||
| "error";
|
|
||||||
|
|
||||||
type ReplyOutcome =
|
type ReplyOutcome =
|
||||||
| "replied"
|
| "replied"
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ export const muteUser = adminAction(
|
|||||||
{ permission: PERMS.USERS_EDIT, schema: muteSchema },
|
{ permission: PERMS.USERS_EDIT, schema: muteSchema },
|
||||||
async (ctx) => {
|
async (ctx) => {
|
||||||
const _target = await guardRank(ctx.data.userId, ctx.session.user.rank);
|
const _target = await guardRank(ctx.data.userId, ctx.session.user.rank);
|
||||||
|
void _target;
|
||||||
const success = await rcon.muteUser(ctx.data.userId, ctx.data.duration);
|
const success = await rcon.muteUser(ctx.data.userId, ctx.data.duration);
|
||||||
if (!success)
|
if (!success)
|
||||||
throw new ActionError("Failed to mute. Is the emulator running?");
|
throw new ActionError("Failed to mute. Is the emulator running?");
|
||||||
@@ -440,6 +441,7 @@ export const sendCredits = adminAction(
|
|||||||
{ permission: PERMS.USERS_EDIT, schema: sendCreditsSchema },
|
{ permission: PERMS.USERS_EDIT, schema: sendCreditsSchema },
|
||||||
async (ctx) => {
|
async (ctx) => {
|
||||||
const _target = await guardRank(ctx.data.userId, ctx.session.user.rank);
|
const _target = await guardRank(ctx.data.userId, ctx.session.user.rank);
|
||||||
|
void _target;
|
||||||
const success = await rcon.giveCredits(ctx.data.userId, ctx.data.amount);
|
const success = await rcon.giveCredits(ctx.data.userId, ctx.data.amount);
|
||||||
if (!success)
|
if (!success)
|
||||||
throw new ActionError("Failed to send credits. Is the emulator running?");
|
throw new ActionError("Failed to send credits. Is the emulator running?");
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import type { CSSProperties } from "react";
|
|||||||
import { applyStaff } from "@/actions/applications";
|
import { applyStaff } from "@/actions/applications";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { resolveHotelName } from "@/lib/hotel-name";
|
import { resolveHotelName } from "@/lib/hotel-name";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
@@ -145,7 +145,13 @@ export default async function ApplyStaffPage({
|
|||||||
<div className="content-card-body">
|
<div className="content-card-body">
|
||||||
<p style={{ margin: "0 0 0.5rem" }}>{position.description}</p>
|
<p style={{ margin: "0 0 0.5rem" }}>{position.description}</p>
|
||||||
<p className="muted" style={{ margin: "0 0 0.75rem" }}>
|
<p className="muted" style={{ margin: "0 0 0.75rem" }}>
|
||||||
{t("deadline", { date: formatDate(position.applyTo, "datetime", t("noDeadline")) })}
|
{t("deadline", {
|
||||||
|
date: formatDate(
|
||||||
|
position.applyTo,
|
||||||
|
"datetime",
|
||||||
|
t("noDeadline"),
|
||||||
|
),
|
||||||
|
})}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{alreadyApplied ? (
|
{alreadyApplied ? (
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import type { CSSProperties } from "react";
|
|||||||
import { applyTeam } from "@/actions/applications";
|
import { applyTeam } from "@/actions/applications";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { resolveHotelName } from "@/lib/hotel-name";
|
import { resolveHotelName } from "@/lib/hotel-name";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ export default async function EventDetailPage({
|
|||||||
})
|
})
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
|
|
||||||
if (!event || (event.status !== "published" && event.status !== "completed")) {
|
if (
|
||||||
|
!event ||
|
||||||
|
(event.status !== "published" && event.status !== "completed")
|
||||||
|
) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +73,7 @@ export default async function EventDetailPage({
|
|||||||
const winnerName = new Map(winners.map((u) => [u.id, u.username]));
|
const winnerName = new Map(winners.map((u) => [u.id, u.username]));
|
||||||
|
|
||||||
const isFull =
|
const isFull =
|
||||||
event.maxPlayers != null &&
|
event.maxPlayers != null && event._count.registrations >= event.maxPlayers;
|
||||||
event._count.registrations >= event.maxPlayers;
|
|
||||||
const hasEnded =
|
const hasEnded =
|
||||||
event.status === "completed" ||
|
event.status === "completed" ||
|
||||||
(event.endsAt != null && event.endsAt.getTime() < Date.now());
|
(event.endsAt != null && event.endsAt.getTime() < Date.now());
|
||||||
@@ -157,7 +159,11 @@ export default async function EventDetailPage({
|
|||||||
</div>
|
</div>
|
||||||
</ContentCard>
|
</ContentCard>
|
||||||
|
|
||||||
<ContentCard icon="✍️" title={t("registerTitle")} subtitle={t("registerSubtitle")}>
|
<ContentCard
|
||||||
|
icon="✍️"
|
||||||
|
title={t("registerTitle")}
|
||||||
|
subtitle={t("registerSubtitle")}
|
||||||
|
>
|
||||||
{session?.user && canRegister ? (
|
{session?.user && canRegister ? (
|
||||||
<EventRegisterButton eventId={event.id} />
|
<EventRegisterButton eventId={event.id} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -112,7 +112,13 @@ export default async function EventsPage() {
|
|||||||
>
|
>
|
||||||
{formatDate(event.startsAt, "datetime", "")}
|
{formatDate(event.startsAt, "datetime", "")}
|
||||||
</p>
|
</p>
|
||||||
<p style={{ margin: 0, fontSize: "0.88rem", lineHeight: 1.5 }}>
|
<p
|
||||||
|
style={{
|
||||||
|
margin: 0,
|
||||||
|
fontSize: "0.88rem",
|
||||||
|
lineHeight: 1.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{excerpt(event.description, 120)}
|
{excerpt(event.description, 120)}
|
||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { getTranslations } from "next-intl/server";
|
|||||||
import type { CSSProperties } from "react";
|
import type { CSSProperties } from "react";
|
||||||
import { replyToThread } from "@/actions/social";
|
import { replyToThread } from "@/actions/social";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 60;
|
export const revalidate = 60;
|
||||||
@@ -216,7 +216,9 @@ export default async function GuildForumThreadPage({
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
<span className="muted" style={{ fontSize: "0.85rem" }}>
|
<span className="muted" style={{ fontSize: "0.85rem" }}>
|
||||||
{formatDate(post.createdAt ? new Date(post.createdAt * 1000) : null)}
|
{formatDate(
|
||||||
|
post.createdAt ? new Date(post.createdAt * 1000) : null,
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
@@ -236,7 +238,11 @@ export default async function GuildForumThreadPage({
|
|||||||
</ContentCard>
|
</ContentCard>
|
||||||
|
|
||||||
{canReply ? (
|
{canReply ? (
|
||||||
<ContentCard icon="✍️" title={t("replyTitle")} subtitle={t("replySubtitle")}>
|
<ContentCard
|
||||||
|
icon="✍️"
|
||||||
|
title={t("replyTitle")}
|
||||||
|
subtitle={t("replySubtitle")}
|
||||||
|
>
|
||||||
<form action={replyToThread}>
|
<form action={replyToThread}>
|
||||||
<input type="hidden" name="guildId" value={String(guild.id)} />
|
<input type="hidden" name="guildId" value={String(guild.id)} />
|
||||||
<input type="hidden" name="threadId" value={String(thread.id)} />
|
<input type="hidden" name="threadId" value={String(thread.id)} />
|
||||||
@@ -262,8 +268,7 @@ export default async function GuildForumThreadPage({
|
|||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<p className="muted" style={{ margin: 0 }}>
|
<p className="muted" style={{ margin: 0 }}>
|
||||||
{t("loginToReply")}{" "}
|
{t("loginToReply")} <Link href="/login">{t("loginLink")}</Link>
|
||||||
<Link href="/login">{t("loginLink")}</Link>
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import Link from "next/link";
|
|||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import type { CSSProperties } from "react";
|
import type { CSSProperties } from "react";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
@@ -190,7 +190,10 @@ export default async function GuildForumPage({
|
|||||||
{t2.postsCount ?? 0}
|
{t2.postsCount ?? 0}
|
||||||
</td>
|
</td>
|
||||||
<td className="muted" style={{ padding: "0.6rem 0.75rem" }}>
|
<td className="muted" style={{ padding: "0.6rem 0.75rem" }}>
|
||||||
{formatDate(t2.createdAt ? new Date(t2.createdAt * 1000) : null, "date")}
|
{formatDate(
|
||||||
|
t2.createdAt ? new Date(t2.createdAt * 1000) : null,
|
||||||
|
"date",
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { notFound } from "next/navigation";
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard, EmptyState, StatBlock } from "@/components/public/ui";
|
import { ContentCard, EmptyState, StatBlock } from "@/components/public/ui";
|
||||||
import { avatarImageUrl } from "@/lib/format";
|
import { avatarImageUrl } from "@/lib/format";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import Link from "next/link";
|
|||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard } from "@/components/public/ui";
|
import { ContentCard } from "@/components/public/ui";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { sanitize } from "@/lib/sanitize";
|
|
||||||
import { SanitizedHtml } from "@/components/shared/sanitized-html";
|
import { SanitizedHtml } from "@/components/shared/sanitized-html";
|
||||||
import { resolveHotelName } from "@/lib/hotel-name";
|
import { resolveHotelName } from "@/lib/hotel-name";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
import { sanitize } from "@/lib/sanitize";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|
||||||
@@ -118,8 +118,8 @@ export default async function HelpCategoryPage({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{/* content is author-supplied HTML — sanitised server-side. */}
|
{/* content is author-supplied HTML — sanitised server-side. */}
|
||||||
<SanitizedHtml html={sanitize(content)} style={{ lineHeight: 1.7 }} />
|
<SanitizedHtml html={sanitize(content)} style={{ lineHeight: 1.7 }} />
|
||||||
|
|
||||||
{hasButton ? (
|
{hasButton ? (
|
||||||
<div style={{ clear: "both", marginTop: "1rem" }}>
|
<div style={{ clear: "both", marginTop: "1rem" }}>
|
||||||
|
|||||||
@@ -99,9 +99,7 @@ export default async function HelpTicketDetailPage({
|
|||||||
replies = [];
|
replies = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const authorIds = [
|
const authorIds = [...new Set([userId, ...replies.map((r) => r.userId)])];
|
||||||
...new Set([userId, ...replies.map((r) => r.userId)]),
|
|
||||||
];
|
|
||||||
let users: { id: number; username: string }[] = [];
|
let users: { id: number; username: string }[] = [];
|
||||||
try {
|
try {
|
||||||
users = await prisma.user.findMany({
|
users = await prisma.user.findMany({
|
||||||
@@ -174,7 +172,11 @@ export default async function HelpTicketDetailPage({
|
|||||||
<Link href="/help/tickets">{t("backToList")}</Link>
|
<Link href="/help/tickets">{t("backToList")}</Link>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ContentCard icon="🎫" title={ticket.title} subtitle={t("ticketId", { id: String(ticket.id) })}>
|
<ContentCard
|
||||||
|
icon="🎫"
|
||||||
|
title={ticket.title}
|
||||||
|
subtitle={t("ticketId", { id: String(ticket.id) })}
|
||||||
|
>
|
||||||
<span className={`online-badge${ticket.open ? " online" : ""}`}>
|
<span className={`online-badge${ticket.open ? " online" : ""}`}>
|
||||||
<span className="online-dot" aria-hidden />
|
<span className="online-dot" aria-hidden />
|
||||||
{ticket.open ? t("statusOpen") : t("statusClosed")}
|
{ticket.open ? t("statusOpen") : t("statusClosed")}
|
||||||
@@ -220,7 +222,9 @@ export default async function HelpTicketDetailPage({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ fontWeight: 700 }}>
|
<span style={{ fontWeight: 700 }}>
|
||||||
{index === 0 ? t("you") : username ? (
|
{index === 0 ? (
|
||||||
|
t("you")
|
||||||
|
) : username ? (
|
||||||
<Link href={`/u/${username}`}>{username}</Link>
|
<Link href={`/u/${username}`}>{username}</Link>
|
||||||
) : (
|
) : (
|
||||||
<span className="muted">
|
<span className="muted">
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ import { auth } from "@/lib/auth";
|
|||||||
* Public site chrome. Route group `(site)` keeps this off `/admin` and `/client`,
|
* Public site chrome. Route group `(site)` keeps this off `/admin` and `/client`,
|
||||||
* so housekeeping is never constrained by the public max-w-7xl grid.
|
* so housekeeping is never constrained by the public max-w-7xl grid.
|
||||||
*/
|
*/
|
||||||
export default async function SiteLayout({ children }: { children: ReactNode }) {
|
export default async function SiteLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
const session = await auth();
|
const session = await auth();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+325
-207
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { ContentCard, EmptyState, StatBlock } from "@/components/public/ui";
|
import { ContentCard, EmptyState, StatBlock } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
@@ -124,7 +124,10 @@ export default async function MarketplacePage() {
|
|||||||
<td style={{ fontWeight: 700 }}>
|
<td style={{ fontWeight: 700 }}>
|
||||||
{o.price.toLocaleString()} cr
|
{o.price.toLocaleString()} cr
|
||||||
</td>
|
</td>
|
||||||
<td className="muted" title={formatDate(new Date(o.timestamp * 1000))}>
|
<td
|
||||||
|
className="muted"
|
||||||
|
title={formatDate(new Date(o.timestamp * 1000))}
|
||||||
|
>
|
||||||
{listedAgo(o.timestamp, t)}
|
{listedAgo(o.timestamp, t)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+438
-153
File diff suppressed because it is too large.
Load diff
@@ -10,8 +10,8 @@ import {
|
|||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { avatarImageUrl } from "@/lib/format";
|
import { avatarImageUrl } from "@/lib/format";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ import { sanitize } from "@/lib/sanitize";
|
|||||||
|
|
||||||
export const revalidate = 60;
|
export const revalidate = 60;
|
||||||
|
|
||||||
type SearchParams = Promise<{ comment?: string; reaction?: string; error?: string }>;
|
type SearchParams = Promise<{
|
||||||
|
comment?: string;
|
||||||
|
reaction?: string;
|
||||||
|
error?: string;
|
||||||
|
}>;
|
||||||
|
|
||||||
function feedbackStyle(tone: "success" | "error"): CSSProperties {
|
function feedbackStyle(tone: "success" | "error"): CSSProperties {
|
||||||
const accent =
|
const accent =
|
||||||
@@ -78,7 +82,6 @@ const REACTIONS: { key: string; emoji: string }[] = [
|
|||||||
{ key: "wow", emoji: "😮" },
|
{ key: "wow", emoji: "😮" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export default async function ArticlePage({
|
export default async function ArticlePage({
|
||||||
params,
|
params,
|
||||||
searchParams,
|
searchParams,
|
||||||
@@ -204,9 +207,7 @@ export default async function ArticlePage({
|
|||||||
icon="📰"
|
icon="📰"
|
||||||
title={article.title}
|
title={article.title}
|
||||||
subtitle={
|
subtitle={
|
||||||
article.createdAt
|
article.createdAt ? formatDate(article.createdAt, "date") : undefined
|
||||||
? formatDate(article.createdAt, "date")
|
|
||||||
: undefined
|
|
||||||
}
|
}
|
||||||
action={
|
action={
|
||||||
<Link className="btn btn-outline" href="/news">
|
<Link className="btn btn-outline" href="/news">
|
||||||
@@ -222,8 +223,11 @@ export default async function ArticlePage({
|
|||||||
style={{ width: "100%", borderRadius: 10, margin: "0 0 1rem" }}
|
style={{ width: "100%", borderRadius: 10, margin: "0 0 1rem" }}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{/* Article body is rich HTML (atom uses TinyMCE) — sanitised server-side. */}
|
{/* Article body is rich HTML (atom uses TinyMCE) — sanitised server-side. */}
|
||||||
<SanitizedHtml html={sanitize(article.fullStory)} className="article-body" />
|
<SanitizedHtml
|
||||||
|
html={sanitize(article.fullStory)}
|
||||||
|
className="article-body"
|
||||||
|
/>
|
||||||
</ContentCard>
|
</ContentCard>
|
||||||
|
|
||||||
{/* ── Reactions ─────────────────────────────────────────── */}
|
{/* ── Reactions ─────────────────────────────────────────── */}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
import { excerpt } from "@/lib/format";
|
import { excerpt } from "@/lib/format";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|
||||||
export const metadata = { title: "News" };
|
export const metadata = { title: "News" };
|
||||||
|
|
||||||
|
|
||||||
export default async function NewsPage() {
|
export default async function NewsPage() {
|
||||||
const t = await getTranslations("pages.news");
|
const t = await getTranslations("pages.news");
|
||||||
|
|
||||||
|
|||||||
+405
-127
File diff suppressed because it is too large.
Load diff
@@ -3,8 +3,8 @@ import {
|
|||||||
type LightboxPhoto,
|
type LightboxPhoto,
|
||||||
PhotoLightbox,
|
PhotoLightbox,
|
||||||
} from "@/components/public/photo-lightbox";
|
} from "@/components/public/photo-lightbox";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ export default async function PollDetailPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (poll.startsAt && poll.startsAt.getTime() > now && poll.status === "active") {
|
if (
|
||||||
|
poll.startsAt &&
|
||||||
|
poll.startsAt.getTime() > now &&
|
||||||
|
poll.status === "active"
|
||||||
|
) {
|
||||||
// Not started yet — treat as unavailable for guests
|
// Not started yet — treat as unavailable for guests
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
@@ -101,7 +105,11 @@ export default async function PollDetailPage({
|
|||||||
|
|
||||||
{isOpen && !hasVoted ? (
|
{isOpen && !hasVoted ? (
|
||||||
session?.user ? (
|
session?.user ? (
|
||||||
<ContentCard icon="🗳️" title={t("voteTitle")} subtitle={t("voteSubtitle")}>
|
<ContentCard
|
||||||
|
icon="🗳️"
|
||||||
|
title={t("voteTitle")}
|
||||||
|
subtitle={t("voteSubtitle")}
|
||||||
|
>
|
||||||
<PollVoteForm
|
<PollVoteForm
|
||||||
pollId={poll.id}
|
pollId={poll.id}
|
||||||
questions={poll.questions.map((q) => ({
|
questions={poll.questions.map((q) => ({
|
||||||
@@ -156,7 +164,10 @@ export default async function PollDetailPage({
|
|||||||
const counts = new Map<string, number>();
|
const counts = new Map<string, number>();
|
||||||
for (const opt of options) counts.set(opt, 0);
|
for (const opt of options) counts.set(opt, 0);
|
||||||
for (const vote of votes) {
|
for (const vote of votes) {
|
||||||
for (const part of vote.split("\n").map((a) => a.trim()).filter(Boolean)) {
|
for (const part of vote
|
||||||
|
.split("\n")
|
||||||
|
.map((a) => a.trim())
|
||||||
|
.filter(Boolean)) {
|
||||||
counts.set(part, (counts.get(part) ?? 0) + 1);
|
counts.set(part, (counts.get(part) ?? 0) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,10 +99,16 @@ export function PollVoteForm({
|
|||||||
value={answers[q.id] ?? ""}
|
value={answers[q.id] ?? ""}
|
||||||
onChange={(e) => setSingle(q.id, e.target.value)}
|
onChange={(e) => setSingle(q.id, e.target.value)}
|
||||||
placeholder={t("textPlaceholder")}
|
placeholder={t("textPlaceholder")}
|
||||||
style={{ width: "100%", marginTop: "0.35rem", resize: "vertical" }}
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
marginTop: "0.35rem",
|
||||||
|
resize: "vertical",
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
) : q.type === "multiple" ? (
|
) : q.type === "multiple" ? (
|
||||||
<div style={{ display: "grid", gap: "0.4rem", marginTop: "0.35rem" }}>
|
<div
|
||||||
|
style={{ display: "grid", gap: "0.4rem", marginTop: "0.35rem" }}
|
||||||
|
>
|
||||||
{options.map((opt) => (
|
{options.map((opt) => (
|
||||||
<label
|
<label
|
||||||
key={opt}
|
key={opt}
|
||||||
@@ -123,7 +129,9 @@ export function PollVoteForm({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div style={{ display: "grid", gap: "0.4rem", marginTop: "0.35rem" }}>
|
<div
|
||||||
|
style={{ display: "grid", gap: "0.4rem", marginTop: "0.35rem" }}
|
||||||
|
>
|
||||||
{options.map((opt) => (
|
{options.map((opt) => (
|
||||||
<label
|
<label
|
||||||
key={opt}
|
key={opt}
|
||||||
|
|||||||
@@ -64,7 +64,13 @@ export default async function PollsPage() {
|
|||||||
{poll.title}
|
{poll.title}
|
||||||
</h3>
|
</h3>
|
||||||
{poll.description ? (
|
{poll.description ? (
|
||||||
<p style={{ margin: 0, fontSize: "0.88rem", lineHeight: 1.5 }}>
|
<p
|
||||||
|
style={{
|
||||||
|
margin: 0,
|
||||||
|
fontSize: "0.88rem",
|
||||||
|
lineHeight: 1.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{excerpt(poll.description, 120)}
|
{excerpt(poll.description, 120)}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard } from "@/components/public/ui";
|
import { ContentCard } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|
||||||
|
|
||||||
export default async function RadioContestDetailPage({
|
export default async function RadioContestDetailPage({
|
||||||
params,
|
params,
|
||||||
}: {
|
}: {
|
||||||
@@ -61,9 +60,13 @@ export default async function RadioContestDetailPage({
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Period</th>
|
<th>Period</th>
|
||||||
<td>
|
<td>
|
||||||
{contest.startDate ? formatDate(contest.startDate, "datetime-seconds", "") : "—"}
|
{contest.startDate
|
||||||
|
? formatDate(contest.startDate, "datetime-seconds", "")
|
||||||
|
: "—"}
|
||||||
{" — "}
|
{" — "}
|
||||||
{contest.endDate ? formatDate(contest.endDate, "datetime-seconds", "") : "ongoing"}
|
{contest.endDate
|
||||||
|
? formatDate(contest.endDate, "datetime-seconds", "")
|
||||||
|
: "ongoing"}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|
||||||
|
|
||||||
export default async function RadioContestsPage() {
|
export default async function RadioContestsPage() {
|
||||||
const t = await getTranslations("pages.radioContests");
|
const t = await getTranslations("pages.radioContests");
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard } from "@/components/public/ui";
|
import { ContentCard } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|
||||||
|
|
||||||
export default async function RadioGiveawayDetailPage({
|
export default async function RadioGiveawayDetailPage({
|
||||||
params,
|
params,
|
||||||
}: {
|
}: {
|
||||||
@@ -66,9 +65,13 @@ export default async function RadioGiveawayDetailPage({
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Period</th>
|
<th>Period</th>
|
||||||
<td>
|
<td>
|
||||||
{giveaway.startDate ? formatDate(giveaway.startDate, "datetime-seconds", "") : "—"}
|
{giveaway.startDate
|
||||||
|
? formatDate(giveaway.startDate, "datetime-seconds", "")
|
||||||
|
: "—"}
|
||||||
{" — "}
|
{" — "}
|
||||||
{giveaway.endDate ? formatDate(giveaway.endDate, "datetime-seconds", "") : "ongoing"}
|
{giveaway.endDate
|
||||||
|
? formatDate(giveaway.endDate, "datetime-seconds", "")
|
||||||
|
: "ongoing"}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const revalidate = 300;
|
export const revalidate = 300;
|
||||||
|
|
||||||
|
|
||||||
export default async function RadioGiveawaysPage() {
|
export default async function RadioGiveawaysPage() {
|
||||||
const t = await getTranslations("pages.radioGiveaways");
|
const t = await getTranslations("pages.radioGiveaways");
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import type { CSSProperties } from "react";
|
import type { CSSProperties } from "react";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { submitRequest } from "@/actions/radio-requests";
|
import { submitRequest } from "@/actions/radio-requests";
|
||||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
@@ -179,7 +179,9 @@ export default async function RadioRequestsPage({
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="muted">
|
<td className="muted">
|
||||||
{r.submittedAt ? formatDate(r.submittedAt, "datetime", "") : "—"}
|
{r.submittedAt
|
||||||
|
? formatDate(r.submittedAt, "datetime", "")
|
||||||
|
: "—"}
|
||||||
</td>
|
</td>
|
||||||
<td>{status}</td>
|
<td>{status}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+309
-204
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -11,8 +11,8 @@ import { env } from "@/env";
|
|||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { LaravelEncrypter } from "@/lib/auth/laravel-encrypter";
|
import { LaravelEncrypter } from "@/lib/auth/laravel-encrypter";
|
||||||
import { totpKeyUri } from "@/lib/auth/totp";
|
import { totpKeyUri } from "@/lib/auth/totp";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { resolveHotelName } from "@/lib/hotel-name";
|
import { resolveHotelName } from "@/lib/hotel-name";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -86,11 +86,7 @@ export default async function SessionsPage({
|
|||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<ContentCard
|
<ContentCard icon="🔐" title={t("title")} subtitle={t("subtitle")} />
|
||||||
icon="🔐"
|
|
||||||
title={t("title")}
|
|
||||||
subtitle={t("subtitle")}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ContentCard
|
<ContentCard
|
||||||
icon="🚪"
|
icon="🚪"
|
||||||
@@ -104,7 +100,11 @@ export default async function SessionsPage({
|
|||||||
</form>
|
</form>
|
||||||
</ContentCard>
|
</ContentCard>
|
||||||
|
|
||||||
<ContentCard icon="✅" title={t("recentTitle")} padded={logins.length === 0}>
|
<ContentCard
|
||||||
|
icon="✅"
|
||||||
|
title={t("recentTitle")}
|
||||||
|
padded={logins.length === 0}
|
||||||
|
>
|
||||||
{logins.length === 0 ? (
|
{logins.length === 0 ? (
|
||||||
<EmptyState icon="🔐">{t("recentEmpty")}</EmptyState>
|
<EmptyState icon="🔐">{t("recentEmpty")}</EmptyState>
|
||||||
) : (
|
) : (
|
||||||
@@ -148,7 +148,11 @@ export default async function SessionsPage({
|
|||||||
{failed.map((f) => (
|
{failed.map((f) => (
|
||||||
<tr key={f.id}>
|
<tr key={f.id}>
|
||||||
<td className="muted" style={{ whiteSpace: "nowrap" }}>
|
<td className="muted" style={{ whiteSpace: "nowrap" }}>
|
||||||
{formatDate(typeof f.attempted_at === "string" ? new Date(f.attempted_at) : f.attempted_at)}
|
{formatDate(
|
||||||
|
typeof f.attempted_at === "string"
|
||||||
|
? new Date(f.attempted_at)
|
||||||
|
: f.attempted_at,
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="muted">{f.ip_address}</td>
|
<td className="muted">{f.ip_address}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -79,7 +79,12 @@ const ARTICLE_SELECT = {
|
|||||||
export default async function ShopPage({
|
export default async function ShopPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
}: {
|
}: {
|
||||||
searchParams: Promise<{ category?: string; bought?: string; error?: string; package?: string }>;
|
searchParams: Promise<{
|
||||||
|
category?: string;
|
||||||
|
bought?: string;
|
||||||
|
error?: string;
|
||||||
|
package?: string;
|
||||||
|
}>;
|
||||||
}) {
|
}) {
|
||||||
const t = await getTranslations("pages.shop");
|
const t = await getTranslations("pages.shop");
|
||||||
const sp = await searchParams;
|
const sp = await searchParams;
|
||||||
@@ -185,8 +190,7 @@ export default async function ShopPage({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<p className="muted" style={{ margin: "0 0 0.75rem" }}>
|
<p className="muted" style={{ margin: "0 0 0.75rem" }}>
|
||||||
{t("creditsHint")}{" "}
|
{t("creditsHint")} <Link href="/shop/topup">{t("topUpLink")}</Link>
|
||||||
<Link href="/shop/topup">{t("topUpLink")}</Link>
|
|
||||||
</p>
|
</p>
|
||||||
{categories.length > 0 ? (
|
{categories.length > 0 ? (
|
||||||
<div
|
<div
|
||||||
@@ -319,8 +323,16 @@ export default async function ShopPage({
|
|||||||
</span>
|
</span>
|
||||||
{isLoggedIn ? (
|
{isLoggedIn ? (
|
||||||
<form action={buyShopArticle} style={{ margin: 0 }}>
|
<form action={buyShopArticle} style={{ margin: 0 }}>
|
||||||
<input type="hidden" name="articleId" value={String(a.id)} />
|
<input
|
||||||
<input type="hidden" name="categoryId" value={categoryId} />
|
type="hidden"
|
||||||
|
name="articleId"
|
||||||
|
value={String(a.id)}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="categoryId"
|
||||||
|
value={categoryId}
|
||||||
|
/>
|
||||||
<button type="submit" className="btn btn-primary">
|
<button type="submit" className="btn btn-primary">
|
||||||
{t("buy")}
|
{t("buy")}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ const BADGE_IMG_BASE = "https://images.habbo.com/c_images/album1584";
|
|||||||
const CURRENCY_DUCKETS = 0;
|
const CURRENCY_DUCKETS = 0;
|
||||||
const CURRENCY_DIAMONDS = 5;
|
const CURRENCY_DIAMONDS = 5;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default async function ProfilePage({
|
export default async function ProfilePage({
|
||||||
params,
|
params,
|
||||||
searchParams,
|
searchParams,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CheckCircle2, Clock, Link2, MailX } from "lucide-react";
|
import { CheckCircle2, Clock, MailX } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { isValidVerificationToken } from "@/actions/email-verify";
|
import { isValidVerificationToken } from "@/actions/email-verify";
|
||||||
@@ -22,8 +22,10 @@ function StatusCard({
|
|||||||
color: string;
|
color: string;
|
||||||
}) {
|
}) {
|
||||||
const gradientMap: Record<string, string> = {
|
const gradientMap: Record<string, string> = {
|
||||||
green: "linear-gradient(140deg, #0A2F1A 0%, #0F3D22 20%, #154C2A 40%, #1B5A32 60%, #20683A 75%, #1A5A30 90%, #144826 100%)",
|
green:
|
||||||
yellow: "linear-gradient(140deg, #3A2F0A 0%, #4A3D0F 20%, #5A4C15 40%, #6A5A1B 60%, #7A6820 75%, #6A5A1A 90%, #5A4814 100%)",
|
"linear-gradient(140deg, #0A2F1A 0%, #0F3D22 20%, #154C2A 40%, #1B5A32 60%, #20683A 75%, #1A5A30 90%, #144826 100%)",
|
||||||
|
yellow:
|
||||||
|
"linear-gradient(140deg, #3A2F0A 0%, #4A3D0F 20%, #5A4C15 40%, #6A5A1B 60%, #7A6820 75%, #6A5A1A 90%, #5A4814 100%)",
|
||||||
red: "linear-gradient(140deg, #3A0F0A 0%, #4A1A0F 20%, #5A2515 40%, #6A301B 60%, #7A3B20 75%, #6A301A 90%, #5A2514 100%)",
|
red: "linear-gradient(140deg, #3A0F0A 0%, #4A1A0F 20%, #5A2515 40%, #6A301B 60%, #7A3B20 75%, #6A301A 90%, #5A2514 100%)",
|
||||||
blue: "linear-gradient(140deg, #0A1A3A 0%, #0F254A 20%, #15305A 40%, #1B3B6A 60%, #20467A 75%, #1A3B6A 90%, #14305A 100%)",
|
blue: "linear-gradient(140deg, #0A1A3A 0%, #0F254A 20%, #15305A 40%, #1B3B6A 60%, #20467A 75%, #1A3B6A 90%, #14305A 100%)",
|
||||||
};
|
};
|
||||||
@@ -33,7 +35,8 @@ function StatusCard({
|
|||||||
<div
|
<div
|
||||||
className="w-full max-w-md overflow-hidden rounded-xl border"
|
className="w-full max-w-md overflow-hidden rounded-xl border"
|
||||||
style={{
|
style={{
|
||||||
borderColor: "color-mix(in srgb, var(--color-text-muted) 12%, transparent)",
|
borderColor:
|
||||||
|
"color-mix(in srgb, var(--color-text-muted) 12%, transparent)",
|
||||||
backgroundColor: "var(--color-surface)",
|
backgroundColor: "var(--color-surface)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -48,12 +51,16 @@ function StatusCard({
|
|||||||
<div
|
<div
|
||||||
className="flex h-16 w-16 items-center justify-center rounded-full"
|
className="flex h-16 w-16 items-center justify-center rounded-full"
|
||||||
style={{
|
style={{
|
||||||
background: "color-mix(in srgb, var(--color-primary) 12%, transparent)",
|
background:
|
||||||
|
"color-mix(in srgb, var(--color-primary) 12%, transparent)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm font-semibold" style={{ color: "var(--color-text-muted)" }}>
|
<p
|
||||||
|
className="text-sm font-semibold"
|
||||||
|
style={{ color: "var(--color-text-muted)" }}
|
||||||
|
>
|
||||||
{subtitle}
|
{subtitle}
|
||||||
</p>
|
</p>
|
||||||
{children}
|
{children}
|
||||||
@@ -107,7 +114,8 @@ export default async function VerifyPage({
|
|||||||
const linkStyle = {
|
const linkStyle = {
|
||||||
background: "var(--color-primary)",
|
background: "var(--color-primary)",
|
||||||
color: "var(--color-primary-foreground)",
|
color: "var(--color-primary-foreground)",
|
||||||
boxShadow: "0 4px 20px color-mix(in srgb, var(--color-primary) 30%, transparent)",
|
boxShadow:
|
||||||
|
"0 4px 20px color-mix(in srgb, var(--color-primary) 30%, transparent)",
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -167,11 +175,14 @@ export default async function VerifyPage({
|
|||||||
<p className="text-sm" style={{ color: "var(--color-text-muted)" }}>
|
<p className="text-sm" style={{ color: "var(--color-text-muted)" }}>
|
||||||
{t("invalidBody")}
|
{t("invalidBody")}
|
||||||
</p>
|
</p>
|
||||||
<Link href="/login" className={`${linkClass} !shadow-none`}
|
<Link
|
||||||
|
href="/login"
|
||||||
|
className={`${linkClass} !shadow-none`}
|
||||||
style={{
|
style={{
|
||||||
background: "transparent",
|
background: "transparent",
|
||||||
color: "var(--color-text-readable)",
|
color: "var(--color-text-readable)",
|
||||||
border: "2px solid color-mix(in srgb, var(--color-text-muted) 20%, transparent)",
|
border:
|
||||||
|
"2px solid color-mix(in srgb, var(--color-text-muted) 20%, transparent)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("backToLogin")}
|
{t("backToLogin")}
|
||||||
@@ -180,4 +191,4 @@ export default async function VerifyPage({
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
type Achievement = {
|
type Achievement = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { notFound, redirect } from "next/navigation";
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { updateAd } from "@/actions/admin-ads";
|
import { updateAd } from "@/actions/admin-ads";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
import { EditAdDeleteButton } from "../ads-table";
|
import { EditAdDeleteButton } from "../ads-table";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { Trash2 } from "lucide-react";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { deleteAd } from "@/actions/admin-ads";
|
import { deleteAd } from "@/actions/admin-ads";
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
import { useServerAction } from "@/hooks/use-server-action";
|
import { useServerAction } from "@/hooks/use-server-action";
|
||||||
|
|
||||||
export type AdRow = {
|
export type AdRow = {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
import { AdsTable } from "./ads-table";
|
import { AdsTable } from "./ads-table";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
@@ -27,17 +27,13 @@ export default async function AdminAds() {
|
|||||||
ads = [];
|
ads = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const latest = ads[0]?.createdAt
|
const latest = ads[0]?.createdAt ? formatDate(ads[0].createdAt, "date") : "—";
|
||||||
? formatDate(ads[0].createdAt, "date")
|
|
||||||
: "—";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main>
|
<main>
|
||||||
<div className="flex justify-end mb-6">
|
<div className="flex justify-end mb-6">
|
||||||
<Button variant="default" asChild>
|
<Button variant="default" asChild>
|
||||||
<Link href="/admin/ads/new">
|
<Link href="/admin/ads/new">+ {t("newAd")}</Link>
|
||||||
+ {t("newAd")}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -60,9 +56,7 @@ export default async function AdminAds() {
|
|||||||
ads={ads.map((ad) => ({
|
ads={ads.map((ad) => ({
|
||||||
id: String(ad.id),
|
id: String(ad.id),
|
||||||
image: ad.image,
|
image: ad.image,
|
||||||
createdAt: ad.createdAt
|
createdAt: ad.createdAt ? formatDate(ad.createdAt, "date") : null,
|
||||||
? formatDate(ad.createdAt, "date")
|
|
||||||
: null,
|
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { sendHotelAlert } from "@/actions/admin-alerts";
|
import { sendHotelAlert } from "@/actions/admin-alerts";
|
||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
const CRITICAL = new Set(["critical", "error", "danger"]);
|
const CRITICAL = new Set(["critical", "error", "danger"]);
|
||||||
const WARNING = new Set(["warning", "warn"]);
|
const WARNING = new Set(["warning", "warn"]);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { dismissApplication } from "@/actions/admin-applications";
|
import { dismissApplication } from "@/actions/admin-applications";
|
||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@ type ApplicationRow = {
|
|||||||
createdAt: Date | null;
|
createdAt: Date | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default async function AdminApplications() {
|
export default async function AdminApplications() {
|
||||||
const { session, permissions } = await getAdminContext();
|
const { session, permissions } = await getAdminContext();
|
||||||
if (!canAccess(permissions, PERMS.USERS_VIEW, session.user.rank)) {
|
if (!canAccess(permissions, PERMS.USERS_VIEW, session.user.rank)) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
|
import { ArticleCard } from "@/components/admin/article-card";
|
||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { ArticleCard } from "@/components/admin/article-card";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
@@ -38,7 +38,9 @@ export default async function AdminArticles({
|
|||||||
.catch(() => []);
|
.catch(() => []);
|
||||||
|
|
||||||
const authorMap = new Map<number, string>();
|
const authorMap = new Map<number, string>();
|
||||||
const authorIds = articles.map((a) => a.userId).filter((id): id is number => Boolean(id));
|
const authorIds = articles
|
||||||
|
.map((a) => a.userId)
|
||||||
|
.filter((id): id is number => Boolean(id));
|
||||||
if (authorIds.length > 0) {
|
if (authorIds.length > 0) {
|
||||||
const authors = await prisma.user
|
const authors = await prisma.user
|
||||||
.findMany({
|
.findMany({
|
||||||
@@ -57,9 +59,7 @@ export default async function AdminArticles({
|
|||||||
<main>
|
<main>
|
||||||
<div className="flex justify-end mb-6">
|
<div className="flex justify-end mb-6">
|
||||||
<Button variant="default" asChild>
|
<Button variant="default" asChild>
|
||||||
<Link href="/admin/articles/new">
|
<Link href="/admin/articles/new">{t("newArticle")}</Link>
|
||||||
{t("newArticle")}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { uploadBadge } from "@/actions/admin-badge-upload";
|
import { uploadBadge } from "@/actions/admin-badge-upload";
|
||||||
import { giveBadge } from "@/actions/admin-badges";
|
import { giveBadge } from "@/actions/admin-badges";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { createBan, liftBan } from "@/actions/admin-bans";
|
|||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { activeBanWhere, unixNow } from "@/lib/bans";
|
import { activeBanWhere, unixNow } from "@/lib/bans";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import Link from "next/link";
|
|||||||
import { notFound, redirect } from "next/navigation";
|
import { notFound, redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
@@ -115,7 +115,10 @@ export default async function AdminCalendarCampaign({
|
|||||||
{t("detail.campaignMeta", {
|
{t("detail.campaignMeta", {
|
||||||
id: campaign.id,
|
id: campaign.id,
|
||||||
days: campaign.totalDays,
|
days: campaign.totalDays,
|
||||||
date: formatDate(new Date(campaign.startTimestamp * 1000), "date"),
|
date: formatDate(
|
||||||
|
new Date(campaign.startTimestamp * 1000),
|
||||||
|
"date",
|
||||||
|
),
|
||||||
})}
|
})}
|
||||||
{disabled
|
{disabled
|
||||||
? ` · ${t("detail.disabled")}`
|
? ` · ${t("detail.disabled")}`
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import Link from "next/link";
|
|||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
@@ -118,7 +118,12 @@ export default async function AdminCalendar() {
|
|||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs theme-text-muted dark:theme-text-muted mt-1">
|
<p className="text-xs theme-text-muted dark:theme-text-muted mt-1">
|
||||||
{t("startsAt", { date: formatDate(new Date(c.startTimestamp * 1000), "date") })}
|
{t("startsAt", {
|
||||||
|
date: formatDate(
|
||||||
|
new Date(c.startTimestamp * 1000),
|
||||||
|
"date",
|
||||||
|
),
|
||||||
|
})}
|
||||||
{c.lockExpired === "1" ? ` · ${t("locksExpired")}` : ""}
|
{c.lockExpired === "1" ? ` · ${t("locksExpired")}` : ""}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -35,12 +35,12 @@ import {
|
|||||||
TooltipProvider,
|
TooltipProvider,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
|
import { useServerAction } from "@/hooks/use-server-action";
|
||||||
import {
|
import {
|
||||||
habboGamedataHotelLabel,
|
habboGamedataHotelLabel,
|
||||||
habboGamedataHotelShort,
|
habboGamedataHotelShort,
|
||||||
normalizeHabboGamedataHotel,
|
normalizeHabboGamedataHotel,
|
||||||
} from "@/lib/habbo-gamedata-hotel";
|
} from "@/lib/habbo-gamedata-hotel";
|
||||||
import { useServerAction } from "@/hooks/use-server-action";
|
|
||||||
import { FurniIcon } from "./catalog-items-table";
|
import { FurniIcon } from "./catalog-items-table";
|
||||||
|
|
||||||
interface BaseItemForTranslation {
|
interface BaseItemForTranslation {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
updateBcItem,
|
updateBcItem,
|
||||||
updateBcPage,
|
updateBcPage,
|
||||||
} from "@/actions/catalog-bc";
|
} from "@/actions/catalog-bc";
|
||||||
|
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
@@ -41,7 +42,6 @@ import {
|
|||||||
} from "@/components/ui/table";
|
} from "@/components/ui/table";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { useServerAction } from "@/hooks/use-server-action";
|
import { useServerAction } from "@/hooks/use-server-action";
|
||||||
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
|
||||||
|
|
||||||
// ── Types ────────────────────────────────────────────────────────────
|
// ── Types ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { DataTable } from "@/components/admin/data-table";
|
|||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useServerAction } from "@/hooks/use-server-action";
|
import { useServerAction } from "@/hooks/use-server-action";
|
||||||
import type { DataTableColumn, PaginatedResult } from "@/types";
|
import type { DataTableColumn, PaginatedResult } from "@/types/common";
|
||||||
|
|
||||||
interface CatalogPageRow {
|
interface CatalogPageRow {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -7,9 +7,9 @@ import {
|
|||||||
OnlineUsersWidget,
|
OnlineUsersWidget,
|
||||||
StatusCard,
|
StatusCard,
|
||||||
} from "@/components/admin/dashboard";
|
} from "@/components/admin/dashboard";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { formatDate } from "@/lib/format-date";
|
|
||||||
import { rcon } from "@/lib/services/rcon";
|
import { rcon } from "@/lib/services/rcon";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
import { CommandocentrumControls } from "./commandocentrum-controls";
|
import { CommandocentrumControls } from "./commandocentrum-controls";
|
||||||
@@ -268,7 +268,10 @@ export default async function CommandoCentrum() {
|
|||||||
return (
|
return (
|
||||||
<tr key={e.id}>
|
<tr key={e.id}>
|
||||||
<td className="text-sm theme-text-muted dark:theme-text-muted whitespace-nowrap">
|
<td className="text-sm theme-text-muted dark:theme-text-muted whitespace-nowrap">
|
||||||
{formatDate(e.timestamp ? new Date(e.timestamp * 1000) : null, "datetime-seconds")}
|
{formatDate(
|
||||||
|
e.timestamp ? new Date(e.timestamp * 1000) : null,
|
||||||
|
"datetime-seconds",
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td>{e.type}</td>
|
<td>{e.type}</td>
|
||||||
<td className="text-sm theme-text-muted dark:theme-text-muted whitespace-nowrap">
|
<td className="text-sm theme-text-muted dark:theme-text-muted whitespace-nowrap">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getTranslations } from "next-intl/server";
|
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { AlertTriangle, Database, HeartPulse, Server } from "lucide-react";
|
import { AlertTriangle, Database, HeartPulse, Server } from "lucide-react";
|
||||||
import { getTranslations } from "next-intl/server";
|
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import {
|
import {
|
||||||
createEmailTemplate,
|
createEmailTemplate,
|
||||||
@@ -5,9 +6,8 @@ import {
|
|||||||
updateEmailTemplate,
|
updateEmailTemplate,
|
||||||
} from "@/actions/admin-email-templates";
|
} from "@/actions/admin-email-templates";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export default async function AdminEmailTemplates() {
|
export default async function AdminEmailTemplates() {
|
||||||
const { session, permissions } = await getAdminContext();
|
const { session, permissions } = await getAdminContext();
|
||||||
|
|||||||
@@ -41,10 +41,16 @@ export default function AdminErrorPage({
|
|||||||
{t("code")}
|
{t("code")}
|
||||||
</p>
|
</p>
|
||||||
<h1 className="text-xl font-extrabold mb-2">{t("title")}</h1>
|
<h1 className="text-xl font-extrabold mb-2">{t("title")}</h1>
|
||||||
<p className="text-sm mb-1" style={{ color: "var(--admin-muted, #6b7280)" }}>
|
<p
|
||||||
|
className="text-sm mb-1"
|
||||||
|
style={{ color: "var(--admin-muted, #6b7280)" }}
|
||||||
|
>
|
||||||
{t("subtitle")}
|
{t("subtitle")}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm mb-6" style={{ color: "var(--admin-muted, #6b7280)" }}>
|
<p
|
||||||
|
className="text-sm mb-6"
|
||||||
|
style={{ color: "var(--admin-muted, #6b7280)" }}
|
||||||
|
>
|
||||||
{t("body")}
|
{t("body")}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex flex-wrap gap-3 justify-center">
|
<div className="flex flex-wrap gap-3 justify-center">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CalendarDays, Gift, Trophy, Users } from "lucide-react";
|
import { CalendarDays, Gift, Trophy, Users } from "lucide-react";
|
||||||
import { getTranslations } from "next-intl/server";
|
|
||||||
import { notFound, redirect } from "next/navigation";
|
import { notFound, redirect } from "next/navigation";
|
||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
import { AdminBreadcrumb } from "@/components/admin/admin-breadcrumb";
|
import { AdminBreadcrumb } from "@/components/admin/admin-breadcrumb";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
@@ -118,7 +118,9 @@ export default async function EventDetailPage({
|
|||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">{t("statPrizes")}</CardTitle>
|
<CardTitle className="text-sm font-medium">
|
||||||
|
{t("statPrizes")}
|
||||||
|
</CardTitle>
|
||||||
<Gift className="h-4 w-4 text-muted-foreground" />
|
<Gift className="h-4 w-4 text-muted-foreground" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
@@ -138,7 +140,9 @@ export default async function EventDetailPage({
|
|||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">{t("statTime")}</CardTitle>
|
<CardTitle className="text-sm font-medium">
|
||||||
|
{t("statTime")}
|
||||||
|
</CardTitle>
|
||||||
<CalendarDays className="h-4 w-4 text-muted-foreground" />
|
<CalendarDays className="h-4 w-4 text-muted-foreground" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
@@ -189,7 +193,8 @@ export default async function EventDetailPage({
|
|||||||
eventId={event.id}
|
eventId={event.id}
|
||||||
winners={event.winners.map((w) => ({
|
winners={event.winners.map((w) => ({
|
||||||
...w,
|
...w,
|
||||||
username: userMap.get(w.userId) ?? t("userFallback", { id: w.userId }),
|
username:
|
||||||
|
userMap.get(w.userId) ?? t("userFallback", { id: w.userId }),
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -197,7 +202,8 @@ export default async function EventDetailPage({
|
|||||||
<EventRegistrations
|
<EventRegistrations
|
||||||
registrations={event.registrations.map((r) => ({
|
registrations={event.registrations.map((r) => ({
|
||||||
...r,
|
...r,
|
||||||
username: userMap.get(r.userId) ?? t("userFallback", { id: r.userId }),
|
username:
|
||||||
|
userMap.get(r.userId) ?? t("userFallback", { id: r.userId }),
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getTranslations } from "next-intl/server";
|
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { EventForm } from "../event-form";
|
import { EventForm } from "../event-form";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { DataTable } from "@/components/admin/data-table";
|
|||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useServerAction } from "@/hooks/use-server-action";
|
import { useServerAction } from "@/hooks/use-server-action";
|
||||||
import type { DataTableColumn, PaginatedResult } from "@/types";
|
import type { DataTableColumn, PaginatedResult } from "@/types/common";
|
||||||
|
|
||||||
interface EventRow {
|
interface EventRow {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ export default async function EventsPage({
|
|||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end">
|
||||||
<Button variant="default" asChild>
|
<Button variant="default" asChild>
|
||||||
<Link href="/admin/events/create">
|
<Link href="/admin/events/create">{t("newEvent")}</Link>
|
||||||
{t("newEvent")}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import Image from "next/image";
|
|||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { deleteFavicon, saveFavicon } from "@/actions/save-favicon";
|
import { deleteFavicon, saveFavicon } from "@/actions/save-favicon";
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
import { FaviconGenerator } from "./favicon-generator";
|
import { FaviconGenerator } from "./favicon-generator";
|
||||||
|
|
||||||
export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
|
export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
|
||||||
@@ -82,7 +82,10 @@ export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
|
|||||||
</h3>
|
</h3>
|
||||||
{preview && (
|
{preview && (
|
||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
<label htmlFor="favicon-current" className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2">
|
<label
|
||||||
|
htmlFor="favicon-current"
|
||||||
|
className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2"
|
||||||
|
>
|
||||||
{t("current")}
|
{t("current")}
|
||||||
</label>
|
</label>
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
@@ -117,11 +120,7 @@ export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button type="submit" disabled={uploading} variant="default">
|
||||||
type="submit"
|
|
||||||
disabled={uploading}
|
|
||||||
variant="default"
|
|
||||||
>
|
|
||||||
{uploading ? t("uploading") : t("upload")}
|
{uploading ? t("uploading") : t("upload")}
|
||||||
</Button>
|
</Button>
|
||||||
{preview && (
|
{preview && (
|
||||||
|
|||||||
@@ -105,7 +105,10 @@ export function FaviconGenerator({ onSave }: Props) {
|
|||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="favicon-text" className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2">
|
<label
|
||||||
|
htmlFor="favicon-text"
|
||||||
|
className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2"
|
||||||
|
>
|
||||||
{t("text")}
|
{t("text")}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@@ -120,7 +123,10 @@ export function FaviconGenerator({ onSave }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="favicon-bgColor" className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2">
|
<label
|
||||||
|
htmlFor="favicon-bgColor"
|
||||||
|
className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2"
|
||||||
|
>
|
||||||
{t("bgColor")}
|
{t("bgColor")}
|
||||||
</label>
|
</label>
|
||||||
<div className="flex items-center gap-2 mb-2">
|
<div className="flex items-center gap-2 mb-2">
|
||||||
@@ -153,7 +159,10 @@ export function FaviconGenerator({ onSave }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="favicon-textColor" className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2">
|
<label
|
||||||
|
htmlFor="favicon-textColor"
|
||||||
|
className="block text-xs font-bold text-[var(--admin-text-muted)] uppercase tracking-wider mb-2"
|
||||||
|
>
|
||||||
{t("textColor")}
|
{t("textColor")}
|
||||||
</label>
|
</label>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { FaviconForm } from "./favicon-form";
|
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
import { FaviconForm } from "./favicon-form";
|
||||||
|
|
||||||
export default async function AdminFaviconPage() {
|
export default async function AdminFaviconPage() {
|
||||||
const { session, permissions } = await getAdminContext();
|
const { session, permissions } = await getAdminContext();
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { notFound, redirect } from "next/navigation";
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { disbandGuild } from "@/actions/admin-guilds";
|
import { disbandGuild } from "@/actions/admin-guilds";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
@@ -95,15 +95,10 @@ export default async function AdminGuildDetailPage({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
<Button variant="ghost" size="sm" asChild>
|
<Button variant="ghost" size="sm" asChild>
|
||||||
<Link href="/admin/guilds">
|
<Link href="/admin/guilds">{t("back")}</Link>
|
||||||
{t("back")}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="sm" asChild>
|
<Button variant="ghost" size="sm" asChild>
|
||||||
<Link
|
<Link href={`/guilds/${guild.id}`} target="_blank">
|
||||||
href={`/guilds/${guild.id}`}
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
{t("viewPublic")}
|
{t("viewPublic")}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -193,7 +188,9 @@ export default async function AdminGuildDetailPage({
|
|||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td className="muted">{m.levelId}</td>
|
<td className="muted">{m.levelId}</td>
|
||||||
<td className="muted">{formatDate(new Date(m.memberSince * 1000))}</td>
|
<td className="muted">
|
||||||
|
{formatDate(new Date(m.memberSince * 1000))}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { AdminSimplePager } from "@/components/admin/admin-simple-pager";
|
|||||||
import { StatusCard } from "@/components/admin/dashboard";
|
import { StatusCard } from "@/components/admin/dashboard";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { calcPagination, parseListParams } from "@/lib/admin-helpers";
|
import { calcPagination, parseListParams } from "@/lib/admin-helpers";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
@@ -184,7 +184,9 @@ export default async function AdminGuildsPage({
|
|||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>{membersByGuild.get(g.id) ?? 0}</td>
|
<td>{membersByGuild.get(g.id) ?? 0}</td>
|
||||||
<td className="muted">{formatDate(new Date(g.dateCreated * 1000), "date")}</td>
|
<td className="muted">
|
||||||
|
{formatDate(new Date(g.dateCreated * 1000), "date")}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import Link from "next/link";
|
|||||||
import { notFound, redirect } from "next/navigation";
|
import { notFound, redirect } from "next/navigation";
|
||||||
import { deleteHelpQuestion, updateHelpQuestion } from "@/actions/admin-help";
|
import { deleteHelpQuestion, updateHelpQuestion } from "@/actions/admin-help";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { prisma } from "@/lib/prisma";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { HelpCircle } from "lucide-react";
|
import { HelpCircle } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
import { createHelpQuestion } from "@/actions/admin-help";
|
import { createHelpQuestion } from "@/actions/admin-help";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
|
|
||||||
export default async function NewHelpQuestion({
|
export default async function NewHelpQuestion({
|
||||||
|
|||||||
Loaded 100 of 292 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user