Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🔥 Delete unused files (#1359)
Luke Vella63725a08799d
diff --git a/apps/landing/src/components/home/color-hash.ts b/apps/landing/src/components/home/color-hash.tsdeleted file mode 100644index 93721495b..000000000--- a/apps/landing/src/components/home/color-hash.ts+++ /dev/null@@ -1,55 +0,0 @@-import ColorHash from "color-hash";--export const colorHash = new ColorHash({- hue: [{ min: 185, max: 320 }],- lightness: [0.65],- saturation: 0.8,-});--type RGBColor = [number, number, number];--const avatarBackgroundColors: RGBColor[] = [- [255, 135, 160],- [255, 179, 71],- [255, 95, 95],- [240, 128, 128],- [255, 160, 122],- [255, 192, 203],- [230, 230, 250],- [173, 216, 230],- [176, 224, 230],- [106, 90, 205],- [123, 104, 238],- [147, 112, 219],- [138, 43, 226],- [148, 0, 211],- [153, 50, 204],- [139, 0, 139],- [75, 0, 130],- [72, 61, 139],- [219, 39, 119],- [236, 72, 153],-];--function isBright(color: RGBColor): boolean {- const [r, g, b] = color;- const L = (0.2126 * r) / 255 + (0.7152 * g) / 255 + (0.0722 * b) / 255;- return L > 0.6 ? true : false;-}--export const getRandomAvatarColor = (str: string) => {- const strSum = str.split("").reduce((acc, val) => acc + val.charCodeAt(0), 0);- const randomIndex = strSum % avatarBackgroundColors.length;- const color = avatarBackgroundColors[randomIndex] as RGBColor;- const [r, g, b] = color;- return { color: `rgb(${r}, ${g}, ${b})`, requiresDarkText: isBright(color) };-};--export const generateGradient = (s: string): string => {- const s1 = s.substring(0, s.length / 2);- const s2 = s.substring(s.length / 2);- const c1 = colorHash.hex(s1);- const c2 = colorHash.hex(s2);-- return `linear-gradient(45deg, ${c1}, ${c2})`;-};diff --git a/apps/web/src/components/badge.tsx b/apps/web/src/components/badge.tsxdeleted file mode 100644index 29e455163..000000000--- a/apps/web/src/components/badge.tsx+++ /dev/null@@ -1,28 +0,0 @@-import clsx from "clsx";-import React from "react";--const Badge: React.FunctionComponent<{- children?: React.ReactNode;- color?: "gray" | "amber" | "green" | "red" | "blue";- className?: string;-}> = ({ children, color = "gray", className }) => {- return (- <div- className={clsx(- "inline-flex h-5 cursor-default items-center rounded-md px-1 text-xs lg:text-sm",- {- "bg-gray-200 text-gray-500": color === "gray",- "bg-amber-100 text-amber-500": color === "amber",- "bg-green-100/50 text-green-500": color === "green",- "bg-rose-100/50 text-rose-500": color === "red",- "bg-cyan-100/50 text-cyan-500": color === "blue",- },- className,- )}- >- {children}- </div>- );-};--export default Badge;diff --git a/apps/web/src/components/button.tsx b/apps/web/src/components/button.tsxdeleted file mode 100644index a0b2362f2..000000000--- a/apps/web/src/components/button.tsx+++ /dev/null@@ -1,52 +0,0 @@-import { Button as NewButton } from "@rallly/ui/button";-import * as React from "react";--export interface ButtonProps- extends Omit<- React.DetailedHTMLProps<- React.ButtonHTMLAttributes<HTMLButtonElement>,- HTMLButtonElement- >,- "type" | "ref"- > {- children?: React.ReactNode;- className?: string;- disabled?: boolean;- loading?: boolean;- icon?: React.ReactElement;- htmlType?: React.ButtonHTMLAttributes<HTMLButtonElement>["type"];- type?: "default" | "primary" | "danger";- form?: string;- title?: string;- onClick?: React.MouseEventHandler<HTMLButtonElement>;-}--export const LegacyButton = React.forwardRef<HTMLButtonElement, ButtonProps>(- function Button(- {- children,- loading,- type = "default",- htmlType = "button",- icon,- disabled,- ...passThroughProps- },- ref,- ) {- return (- <NewButton- ref={ref}- type={htmlType}- loading={loading}- variant={type === "danger" ? "destructive" : type}- {...passThroughProps}- role="button"- disabled={disabled}- >- {icon ? React.cloneElement(icon, { className: "size-5 mr-1.5" }) : null}- {children}- </NewButton>- );- },-);diff --git a/apps/web/src/components/card.tsx b/apps/web/src/components/card.tsxdeleted file mode 100644index 54fa93057..000000000--- a/apps/web/src/components/card.tsx+++ /dev/null@@ -1,22 +0,0 @@-import { cn } from "@rallly/ui";--export const Card = (- props: React.PropsWithChildren<{- className?: string;- fullWidthOnMobile?: boolean;- }>,-) => {- return (- <div- className={cn(- "max-w-full overflow-hidden bg-white shadow-sm",- props.fullWidthOnMobile- ? "sm:rounded-md sm:border-x sm:border-y"- : "rounded-md border shadow-sm",- props.className,- )}- >- {props.children}- </div>- );-};diff --git a/apps/web/src/components/data-table.tsx b/apps/web/src/components/data-table.tsxdeleted file mode 100644index 328e1eed9..000000000--- a/apps/web/src/components/data-table.tsx+++ /dev/null@@ -1,79 +0,0 @@-"use client";--import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from "@rallly/ui/table";-import {- ColumnDef,- flexRender,- getCoreRowModel,- useReactTable,-} from "@tanstack/react-table";--interface DataTableProps<TData, TValue> {- columns: ColumnDef<TData, TValue>[];- data: TData[];-}--export function DataTable<TData, TValue>({- columns,- data,-}: DataTableProps<TData, TValue>) {- const table = useReactTable({- data,- columns,- getCoreRowModel: getCoreRowModel(),- });-- return (- <div className="rounded-md border">- <Table>- <TableHeader>- {table.getHeaderGroups().map((headerGroup) => (- <TableRow key={headerGroup.id}>- {headerGroup.headers.map((header) => {- return (- <TableHead key={header.id}>- {header.isPlaceholder- ? null- : flexRender(- header.column.columnDef.header,- header.getContext(),- )}- </TableHead>- );- })}- </TableRow>- ))}- </TableHeader>- <TableBody>- {table.getRowModel().rows?.length ? (- table.getRowModel().rows.map((row) => (- <TableRow- key={row.id}- data-state={row.getIsSelected() && "selected"}- >- {row.getVisibleCells().map((cell) => (- <TableCell key={cell.id}>- {flexRender(cell.column.columnDef.cell, cell.getContext())}- </TableCell>- ))}- </TableRow>- ))- ) : (- <TableRow>- <TableCell colSpan={columns.length} className="h-24 text-center">- No results.- </TableCell>- </TableRow>- )}- </TableBody>- </Table>- </div>- );-}diff --git a/apps/web/src/components/menu-styles.ts b/apps/web/src/components/menu-styles.tsdeleted file mode 100644index 3aa8bacce..000000000--- a/apps/web/src/components/menu-styles.ts+++ /dev/null@@ -1,13 +0,0 @@-import clsx from "clsx";--export const styleMenuItem = ({- active,- selected,-}: {- active: boolean;- selected: boolean;-}) =>- clsx("menu-item text-sm", {- "font-medium": selected,- "bg-blue-50": active,- });diff --git a/apps/web/src/components/no-ssr.tsx b/apps/web/src/components/no-ssr.tsxdeleted file mode 100644index 7939e4738..000000000--- a/apps/web/src/components/no-ssr.tsx+++ /dev/null@@ -1,10 +0,0 @@-import dynamic from "next/dynamic";-import React from "react";--const NoSsr = (props: { children?: React.ReactNode }) => (- <React.Fragment>{props.children}</React.Fragment>-);--export default dynamic(() => Promise.resolve(NoSsr), {- ssr: false,-});diff --git a/apps/web/src/components/pay-wall.tsx b/apps/web/src/components/pay-wall.tsxdeleted file mode 100644index 43f13afb7..000000000--- a/apps/web/src/components/pay-wall.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { Badge } from "@rallly/ui/badge";-import { Button } from "@rallly/ui/button";-import { m } from "framer-motion";-import Link from "next/link";-import { useParams } from "next/navigation";-import React from "react";--import { Trans } from "@/components/trans";-import { usePlan } from "@/contexts/plan";--const Teaser = () => {- const params = useParams();-- return (- <m.div- transition={{- delay: 0.3,- duration: 1,- type: "spring",- bounce: 0.5,- }}- initial={{ opacity: 0, y: 50 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, scale: 0.9 }}- className="sm:shadow-huge mx-auto w-[420px] max-w-full translate-y-0 space-y-2 rounded-md border bg-gray-50/90 p-4 shadow-sm sm:space-y-6"- >- <div className="pt-4">- <m.div- transition={{- delay: 0.5,- duration: 0.4,- type: "spring",- bounce: 0.5,- }}- initial={{ opacity: 0, y: -50 }}- animate={{ opacity: 1, y: 0 }}- className="text-center"- aria-hidden="true"- >- <Badge- size="lg"- variant="primary"- className="translate-y-0 px-4 py-0.5"- >- <Trans i18nKey="planPro" />- </Badge>- </m.div>- </div>-- <div className="space-y-6">- <div className="space-y-2 text-center">- <h2 className="text-center text-xl font-bold">- <Trans defaults="Pro Feature" i18nKey="proFeature" />- </h2>- <p className="text-muted-foreground mx-auto max-w-xs text-center text-sm leading-relaxed">- <Trans- i18nKey="upgradeOverlaySubtitle2"- defaults="Please upgrade to a paid plan to use this feature. This is how we keep the lights on :)"- />- </p>- </div>- <div className="grid gap-2.5">- <Button variant="primary" asChild>- <Link href="/settings/billing">- <Trans i18nKey="upgrade" defaults="Upgrade" />- </Link>- </Button>- <Button asChild className="w-full">- <Link href={`/poll/${params?.urlId as string}`}>- <Trans i18nKey="notToday" defaults="Not Today" />- </Link>- </Button>- </div>- </div>- </m.div>- );-};--export const PayWall = ({ children }: React.PropsWithChildren) => {- const isPaid = usePlan() === "paid";-- if (isPaid) {- return <>{children}</>;- }- return (- <div className="relative">- <div className="pointer-events-none absolute top-8 hidden w-full scale-90 opacity-20 blur-sm sm:block">- {children}- </div>- <div className="relative z-10 w-full">- <Teaser />- </div>- </div>- );-};--export const PayWallTeaser = ({ children }: React.PropsWithChildren) => {- return <div>{children}</div>;-};diff --git a/apps/web/src/contexts/current-event.ts b/apps/web/src/contexts/current-event.tsdeleted file mode 100644index 720556443..000000000--- a/apps/web/src/contexts/current-event.ts+++ /dev/null@@ -1,72 +0,0 @@-import React from "react";-import { createStateContext } from "react-use";--import { trpc } from "@/utils/trpc/client";--export const [usePollId, PollIdProvider] = createStateContext<string>("");--const useCurrentEventId = () => {- const [pollId] = usePollId();- return pollId;-};--export const useCurrentPollResponses = () => {- const pollId = useCurrentEventId();- return trpc.polls.participants.list.useQuery({ pollId });-};--export const useCurrentEvent = () => {- const pollId = useCurrentEventId();- return trpc.polls.get.useQuery({ urlId: pollId });-};--export type OptionScore = {- yes: string[];- ifNeedBe: string[];- no: string[];-};--export const useCreatePollLink = () => {- const pollId = useCurrentEventId();- const basePath = `/poll/${pollId}`;- return React.useCallback(- (path?: string) => (path ? `${basePath}/${path}` : basePath),- [basePath],- );-};--export const useScore = (optionId: string) => {- const { data: participants = [] } = useCurrentPollResponses();- return participants.reduce(- (acc, participant) => {- for (const vote of participant.votes) {- if (vote.optionId === optionId) {- acc[vote.type]++;- }- }- return acc;- },- {- yes: 0,- ifNeedBe: 0,- no: 0,- },- );-};--// export const useDateFormatter = () => {-// const { dayjs } = useDayjs();-// const { preferredTimeZone } = useUserPreferences();-// const { data: event } = useCurrentEvent();--// return React.useCallback(-// (date: string | number | Date, format: string) => {-// let d = dayjs(date).utc();-// if (event?.timeZone) {-// d = d.tz(event.timeZone, true).tz(preferredTimeZone);-// }-// return d.format(format);-// },-// [dayjs, event?.timeZone, preferredTimeZone],-// );-// };diff --git a/packages/ui/src/helpers/input-attributes.ts b/packages/ui/src/helpers/input-attributes.tsdeleted file mode 100644index 8a3aa2c81..000000000--- a/packages/ui/src/helpers/input-attributes.ts+++ /dev/null@@ -1,85 +0,0 @@-// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes--type InputAttributes =- | "accept"- | "alt"- | "autocapitalize"- | "autocomplete"- | "capture"- | "checked"- | "defaultChecked"- | "defaultValue"- | "disabled"- | "form"- | "formaction"- | "formenctype"- | "formmethod"- | "formnovalidate"- | "formtarget"- | "height"- | "list"- | "max"- | "maxlength"- | "min"- | "minlength"- | "multiple"- | "name"- | "pattern"- | "placeholder"- | "popovertarget"- | "popovertargetaction"- | "readonly"- | "required"- | "size"- | "src"- | "step"- | "type"- | "value"- | "width";--// Includes all text-like inputs, e.g. text, email, password, number, date, etc.-type InputTextualAttributes =- | "autoCapitalize"- | "autoComplete"- | "defaultValue"- | "disabled"- | "form"- | "list"- | "maxLength"- | "minLength"- | "min"- | "multiple"- | "max"- | "name"- | "pattern"- | "placeholder"- | "readOnly"- | "required"- | "size"- | "step"- | "type"- | "value";--type InputRadioAttributes =- | "checked"- | "defaultChecked"- | "defaultValue"- | "disabled"- | "form"- | "name"- | "required"- | "value";--type NotInputRadioAttributes = Exclude<InputAttributes, InputRadioAttributes>;-type NotInputTextualAttributes = Exclude<- InputAttributes,- InputTextualAttributes->;--export type {- InputAttributes,- InputRadioAttributes,- InputTextualAttributes,- NotInputRadioAttributes,- NotInputTextualAttributes,-};diff --git a/packages/ui/src/types.ts b/packages/ui/src/types.tsdeleted file mode 100644index e69de29bb..000000000