fixed imports from shared libary

This commit is contained in:
PxlLoewe
2025-06-26 21:42:10 -07:00
parent d2ea168312
commit 4068fdb807
9 changed files with 50 additions and 94 deletions

View File

@@ -5,7 +5,7 @@ import { Penalty, PenaltyType, Report, User } from "@repo/db";
import { ColumnDef } from "@tanstack/react-table"; import { ColumnDef } from "@tanstack/react-table";
import { formatDistance } from "date-fns"; import { formatDistance } from "date-fns";
import { de } from "date-fns/locale"; import { de } from "date-fns/locale";
import { cn } from "../../../../helper/cn"; import { cn } from "@repo/shared-components";
import { HobbyKnifeIcon } from "@radix-ui/react-icons"; import { HobbyKnifeIcon } from "@radix-ui/react-icons";
export const penaltyColumns: ColumnDef<Penalty & { Report: Report; CreatedUser: User | null }>[] = [ export const penaltyColumns: ColumnDef<Penalty & { Report: Report; CreatedUser: User | null }>[] = [

View File

@@ -39,7 +39,7 @@ import { Select } from "../../../../../_components/ui/Select";
import { UserOptionalDefaults, UserOptionalDefaultsSchema } from "@repo/db/zod"; import { UserOptionalDefaults, UserOptionalDefaultsSchema } from "@repo/db/zod";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { PaginatedTable, PaginatedTableRef } from "_components/PaginatedTable"; import { PaginatedTable, PaginatedTableRef } from "_components/PaginatedTable";
import { cn } from "../../../../../../helper/cn"; import { cn } from "@repo/shared-components";
import { import {
ChartBarBigIcon, ChartBarBigIcon,
Check, Check,

View File

@@ -2,7 +2,7 @@
import { use, useEffect } from "react"; import { use, useEffect } from "react";
import { CheckCircledIcon, CalendarIcon, EnterIcon } from "@radix-ui/react-icons"; import { CheckCircledIcon, CalendarIcon, EnterIcon } from "@radix-ui/react-icons";
import { Event, EventAppointment, Participant, User } from "@repo/db"; import { Event, EventAppointment, Participant, User } from "@repo/db";
import { cn } from "../../../../helper/cn"; import { cn } from "@repo/shared-components";
import { inscribeToMoodleCourse, upsertParticipant } from "../actions"; import { inscribeToMoodleCourse, upsertParticipant } from "../actions";
import { Check, Clock10Icon, EyeIcon, TriangleAlert } from "lucide-react"; import { Check, Clock10Icon, EyeIcon, TriangleAlert } from "lucide-react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";

View File

@@ -1,5 +1,5 @@
import { ButtonHTMLAttributes, DetailedHTMLProps, useEffect, useState } from "react"; import { ButtonHTMLAttributes, DetailedHTMLProps, useEffect, useState } from "react";
import { cn } from "../../../helper/cn"; import { cn } from "@repo/shared-components";
export const Button = ({ export const Button = ({
isLoading, isLoading,

View File

@@ -1,11 +1,6 @@
import React from "react"; import React from "react";
import { import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
FieldValues, import { cn } from "@repo/shared-components";
Path,
RegisterOptions,
UseFormReturn,
} from "react-hook-form";
import { cn } from "../../../helper/cn";
interface InputProps<T extends FieldValues> interface InputProps<T extends FieldValues>
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "form"> { extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "form"> {
@@ -30,17 +25,12 @@ export const Input = <T extends FieldValues>({
<span className="text-lg flex items-center gap-2">{label}</span> <span className="text-lg flex items-center gap-2">{label}</span>
<input <input
{...form.register(name, formOptions)} {...form.register(name, formOptions)}
className={cn( className={cn("input input-bordered w-full placeholder:text-neutral-600", className)}
"input input-bordered w-full placeholder:text-neutral-600",
className,
)}
placeholder={placeholder} placeholder={placeholder}
{...inputProps} {...inputProps}
/> />
{form.formState.errors[name] && ( {form.formState.errors[name] && (
<p className="text-error"> <p className="text-error">{form.formState.errors[name].message as string}</p>
{form.formState.errors[name].message as string}
</p>
)} )}
</label> </label>
); );

View File

@@ -1,14 +1,8 @@
import DatePicker, { DatePickerProps, registerLocale } from "react-datepicker"; import DatePicker, { DatePickerProps, registerLocale } from "react-datepicker";
import { import { Control, Controller, FieldValues, Path, PathValue } from "react-hook-form";
Control,
Controller,
FieldValues,
Path,
PathValue,
} from "react-hook-form";
import { de } from "date-fns/locale"; import { de } from "date-fns/locale";
import { useState } from "react"; import { useState } from "react";
import { cn } from "../../../helper/cn"; import { cn } from "@repo/shared-components";
registerLocale("de", de); registerLocale("de", de);
interface ListInputProps<T extends FieldValues> interface ListInputProps<T extends FieldValues>

View File

@@ -1,46 +1,37 @@
'use client'; "use client";
import MDEditor from '@uiw/react-md-editor'; import MDEditor from "@uiw/react-md-editor";
import { import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
FieldValues, import { cn } from "@repo/shared-components";
Path,
RegisterOptions,
UseFormReturn,
} from 'react-hook-form';
import { cn } from '../../../helper/cn';
interface MarkdownEditorProps<T extends FieldValues> { interface MarkdownEditorProps<T extends FieldValues> {
name: Path<T>; name: Path<T>;
form: UseFormReturn<T>; form: UseFormReturn<T>;
formOptions?: RegisterOptions<T>; formOptions?: RegisterOptions<T>;
label?: string; label?: string;
placeholder?: string; placeholder?: string;
className?: string; className?: string;
} }
export const MarkdownEditor = <T extends FieldValues>({ export const MarkdownEditor = <T extends FieldValues>({
name, name,
label = name, label = name,
placeholder = label, placeholder = label,
form, form,
className, className,
}: MarkdownEditorProps<T>) => { }: MarkdownEditorProps<T>) => {
return ( return (
<label className="floating-label w-full mt-5"> <label className="floating-label w-full mt-5">
<span className="text-lg flex items-center gap-2">{label}</span> <span className="text-lg flex items-center gap-2">{label}</span>
<div className={cn('border rounded-lg p-2 w-full', className)}> <div className={cn("border rounded-lg p-2 w-full", className)}>
<MDEditor <MDEditor
value={form.watch(name)} value={form.watch(name)}
onChange={(value) => onChange={(value) => form.setValue(name, value as any, { shouldValidate: true })}
form.setValue(name, value as any, { shouldValidate: true }) textareaProps={{ placeholder }}
} />
textareaProps={{ placeholder }} </div>
/> {form.formState.errors[name] && (
</div> <p className="text-error">{form.formState.errors[name].message as string}</p>
{form.formState.errors[name] && ( )}
<p className="text-error"> </label>
{form.formState.errors[name].message as string} );
</p>
)}
</label>
);
}; };

View File

@@ -1,20 +1,11 @@
"use client"; "use client";
import { import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
FieldValues, import SelectTemplate, { Props as SelectTemplateProps, StylesConfig } from "react-select";
Path, import { cn } from "@repo/shared-components";
RegisterOptions,
UseFormReturn,
} from "react-hook-form";
import SelectTemplate, {
Props as SelectTemplateProps,
StylesConfig,
} from "react-select";
import { cn } from "../../../helper/cn";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import { CSSProperties } from "react"; import { CSSProperties } from "react";
interface SelectProps<T extends FieldValues> interface SelectProps<T extends FieldValues> extends Omit<SelectTemplateProps, "form"> {
extends Omit<SelectTemplateProps, "form"> {
label?: any; label?: any;
name: Path<T>; name: Path<T>;
form: UseFormReturn<T> | any; form: UseFormReturn<T> | any;
@@ -70,9 +61,7 @@ const SelectCom = <T extends FieldValues>({
}: SelectProps<T>) => { }: SelectProps<T>) => {
return ( return (
<div> <div>
<span className="label-text text-lg flex items-center gap-2"> <span className="label-text text-lg flex items-center gap-2">{label}</span>
{label}
</span>
<SelectTemplate <SelectTemplate
onChange={(newValue: any) => { onChange={(newValue: any) => {
if (Array.isArray(newValue)) { if (Array.isArray(newValue)) {
@@ -89,12 +78,8 @@ const SelectCom = <T extends FieldValues>({
}} }}
value={ value={
(inputProps as any)?.isMulti (inputProps as any)?.isMulti
? (inputProps as any).options?.filter((o: any) => ? (inputProps as any).options?.filter((o: any) => form.watch(name)?.includes(o.value))
form.watch(name)?.includes(o.value), : (inputProps as any).options?.find((o: any) => o.value === form.watch(name))
)
: (inputProps as any).options?.find(
(o: any) => o.value === form.watch(name),
)
} }
styles={customStyles as any} styles={customStyles as any}
className={cn("w-full placeholder:text-neutral-600", className)} className={cn("w-full placeholder:text-neutral-600", className)}
@@ -102,17 +87,13 @@ const SelectCom = <T extends FieldValues>({
{...inputProps} {...inputProps}
/> />
{form.formState.errors[name]?.message && ( {form.formState.errors[name]?.message && (
<p className="text-error"> <p className="text-error">{form.formState.errors[name].message as string}</p>
{form.formState.errors[name].message as string}
</p>
)} )}
</div> </div>
); );
}; };
const SelectWrapper = <T extends FieldValues>(props: SelectProps<T>) => ( const SelectWrapper = <T extends FieldValues>(props: SelectProps<T>) => <SelectCom {...props} />;
<SelectCom {...props} />
);
export const Select = dynamic(() => Promise.resolve(SelectWrapper), { export const Select = dynamic(() => Promise.resolve(SelectWrapper), {
ssr: false, ssr: false,

View File

@@ -1,5 +1,5 @@
import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form"; import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
import { cn } from "../../../helper/cn"; import { cn } from "@repo/shared-components";
interface InputProps<T extends FieldValues> interface InputProps<T extends FieldValues>
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "form"> { extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "form"> {