Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🗑️ Remove dead code surfaced by the structure cleanup (#2611)
Luke Vellacd29ad301b8f
diff --git a/apps/web/src/components/redirect.tsx b/apps/web/src/components/redirect.tsxdeleted file mode 100644index 282d9e971..000000000--- a/apps/web/src/components/redirect.tsx+++ /dev/null@@ -1,32 +0,0 @@-"use client";--import Link from "next/link";-import { useRouter } from "next/navigation";-import { useTimeoutFn } from "react-use";--import { PageDialog, PageDialogDescription } from "@/components/page-dialog";-import { Trans } from "@/i18n/client";--export function Redirect({ href }: { from: string; href: string }) {- const router = useRouter();- useTimeoutFn(() => {- router.push(href);- }, 3000);-- return (- <PageDialog>- <PageDialogDescription>- <Trans- i18nKey="pageMovedDescription"- defaults="Redirecting to <a>{newUrl}</a>"- values={{- newUrl: href,- }}- components={{- a: <Link className="text-link" href={href} />,- }}- />- </PageDialogDescription>- </PageDialog>- );-}diff --git a/apps/web/src/features/auth/data.ts b/apps/web/src/features/auth/data.tsdeleted file mode 100644index 92b3f090d..000000000--- a/apps/web/src/features/auth/data.ts+++ /dev/null@@ -1,91 +0,0 @@-import "server-only";-import { prisma } from "@rallly/database";--/**- * Normalizes an email address by removing aliases and standardizing format- * based on the email provider's alias conventions.- *- * Handles:- * - Gmail: Removes dots and plus aliases ([email protected] → [email protected])- * - Yahoo: Removes hyphen aliases ([email protected] → [email protected])- * - Outlook/Hotmail/Live: Removes plus aliases- * - iCloud: Removes plus aliases- * - ProtonMail: Removes plus aliases- * - FastMail: Removes plus aliases- * - Hey: Removes plus aliases- *- * @param email The email address to normalize- * @returns The normalized email address- */-function normalizeEmail(email: string): string {- if (!email || !email.includes("@")) {- return email;- }-- const parts = email.toLowerCase().split("@");- let localPart = parts[0];- const domain = parts[1];-- // Handle Gmail's dot-ignoring and plus aliases- if (domain === "gmail.com" || domain === "googlemail.com") {- // Remove all dots from the local part- localPart = localPart.replace(/\./g, "");- // Remove everything after the first plus- localPart = localPart.split("+")[0];- }- // Handle Yahoo's hyphen aliases- else if (- domain === "yahoo.com" ||- domain === "ymail.com" ||- domain === "rocketmail.com"- ) {- // Remove everything after the first hyphen- localPart = localPart.split("-")[0];- }- // Handle plus aliases for other common providers- else if (- [- "outlook.com",- "hotmail.com",- "live.com",- "msn.com",- "icloud.com",- "me.com",- "mac.com",- "protonmail.com",- "pm.me",- "proton.me",- "fastmail.com",- "fastmail.fm",- "hey.com",- ].includes(domain)- ) {- // Remove everything after the first plus- localPart = localPart.split("+")[0];- }-- return `${localPart}@${domain}`;-}--/**- * Checks if a user is banned by their email address,- * taking into account email aliases that could be used to bypass bans.- *- * @param email The email address to check- * @returns Whether the user with this email is banned- */-export async function isEmailBanned(email: string) {- const normalizedEmail = normalizeEmail(email);-- // Check both the original and normalized emails- const bannedUser = await prisma.user.count({- where: {- OR: [- { email, banned: true },- { email: normalizedEmail, banned: true },- ],- },- });-- return bannedUser > 0;-}diff --git a/apps/web/src/lib/utils/local-storage.ts b/apps/web/src/lib/utils/local-storage.tsdeleted file mode 100644index 537cb9c59..000000000--- a/apps/web/src/lib/utils/local-storage.ts+++ /dev/null@@ -1,60 +0,0 @@-import * as Sentry from "@sentry/nextjs";--/**- * Wrapper around localStorage that catches errors and logs them to Sentry.- */-class LocalStorage {- private isLocalStorageAvailable: boolean;-- constructor() {- this.isLocalStorageAvailable = this.checkLocalStorageAvailability();- }-- private checkLocalStorageAvailability(): boolean {- try {- if (typeof window === "undefined") return false;-- // Test localStorage by actually trying to use it- const testKey = "__storage_test__";- localStorage.setItem(testKey, testKey);- localStorage.removeItem(testKey);- return true;- } catch {- return false;- }- }-- getItem(key: string): string | null {- if (this.isLocalStorageAvailable) {- try {- return localStorage.getItem(key);- } catch (e) {- Sentry.captureException(e);- return null;- }- }- return null;- }-- setItem(key: string, value: string): void {- if (this.isLocalStorageAvailable) {- try {- localStorage.setItem(key, value);- } catch (e) {- Sentry.captureException(e);- }- }- }-- removeItem(key: string): void {- if (this.isLocalStorageAvailable) {- try {- localStorage.removeItem(key);- } catch (e) {- Sentry.captureException(e);- }- }- }-}--export const safeLocalStorage = new LocalStorage();diff --git a/apps/web/src/lib/utils/date-time-utils.test.ts b/apps/web/src/lib/utils/timezone-schema.test.tssimilarity index 100%rename from apps/web/src/lib/utils/date-time-utils.test.tsrename to apps/web/src/lib/utils/timezone-schema.test.ts