Documentation & Formatting Changes

Co-Authored-By: svedev <28451791+svedev0@users.noreply.github.com>
This commit is contained in:
MD1125 2025-06-23 16:22:32 +02:00
parent 8c23c68565
commit f542df17ab
12 changed files with 345 additions and 69 deletions

View file

@ -1,22 +1,26 @@
// src/lib/auth.ts (or your auth config file)
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { env } from '$env/dynamic/private';
import { env as privateEnv } from '$env/dynamic/private';
import { env as publicEnv } from '$env/dynamic/public';
import { db } from "./server/db";
import * as schema from "./server/db/schema";
import { generateUsername } from "./utils/random";
import { uploadProfilePicture } from "./server/s3";
if (!env.GOOGLE_CLIENT_ID) throw new Error('GOOGLE_CLIENT_ID is not set');
if (!env.GOOGLE_CLIENT_SECRET) throw new Error('GOOGLE_CLIENT_SECRET is not set');
if (!privateEnv.GOOGLE_CLIENT_ID) throw new Error('GOOGLE_CLIENT_ID is not set');
if (!privateEnv.GOOGLE_CLIENT_SECRET) throw new Error('GOOGLE_CLIENT_SECRET is not set');
if (!publicEnv.PUBLIC_BETTER_AUTH_URL) throw new Error('BETTER_AUTH_URL is not set');
export const auth = betterAuth({
baseURL: env.PUBLIC_BETTER_AUTH_URL,
secret: env.PRIVATE_BETTER_AUTH_SECRET,
baseURL: publicEnv.PUBLIC_BETTER_AUTH_URL,
secret: privateEnv.PRIVATE_BETTER_AUTH_SECRET,
appName: "Rugplay",
trustedOrigins: [
env.BETTER_AUTH_URL, "http://rugplay.com", "http://localhost:5173",
publicEnv.PUBLIC_BETTER_AUTH_URL,
"http://rugplay.com",
"http://localhost:5173",
],
database: drizzleAdapter(db, {
@ -25,8 +29,8 @@ export const auth = betterAuth({
}),
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
clientId: privateEnv.GOOGLE_CLIENT_ID,
clientSecret: privateEnv.GOOGLE_CLIENT_SECRET,
mapProfileToUser: async (profile) => {
const newUsername = generateUsername();
let s3ImageKey: string | null = null;
@ -62,7 +66,7 @@ export const auth = betterAuth({
user: {
additionalFields: {
username: { type: "string", required: true, input: false },
isAdmin: { type: "boolean", required: false, input: false },
isAdmin: { type: "boolean", required: true, input: false },
isBanned: { type: "boolean", required: false, input: false },
banReason: { type: "string", required: false, input: false },
baseCurrencyBalance: { type: "string", required: false, input: false },

View file

@ -203,13 +203,15 @@
<!-- Page dots -->
<div class="flex items-center justify-center gap-2">
{#each tips as _, index}
{#each tips as tip, index}
<button
onclick={() => goToPage(index)}
class="h-2 w-2 rounded-full transition-colors {index === currentPage
? 'bg-primary'
: 'bg-muted-foreground/30 hover:bg-muted-foreground/50'}"
/>
aria-label={`Go to tip ${index + 1}: ${tip.title}`}
aria-current={index === currentPage ? 'page' : undefined}
></button>
{/each}
</div>
</div>

View file

@ -63,6 +63,8 @@ export function formatPrice(price: number): string {
export function formatValue(value: number | string): string {
const numValue = typeof value === 'string' ? parseFloat(value) : value;
if (typeof numValue !== 'number' || isNaN(numValue)) return '$0.00';
if (numValue >= 1e12) return `$${(numValue / 1e12).toFixed(2)}T`;
if (numValue >= 1e9) return `$${(numValue / 1e9).toFixed(2)}B`;
if (numValue >= 1e6) return `$${(numValue / 1e6).toFixed(2)}M`;
if (numValue >= 1e3) return `$${(numValue / 1e3).toFixed(2)}K`;