Login-text, Context menu QoL enhancements
This commit is contained in:
@@ -113,19 +113,7 @@ export const ContextMenu = () => {
|
|||||||
style={{ transform: "translateX(-50%)" }}
|
style={{ transform: "translateX(-50%)" }}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const { parsed } = await getOsmAddress(contextMenu.lat, contextMenu.lng);
|
const { parsed } = await getOsmAddress(contextMenu.lat, contextMenu.lng);
|
||||||
const objects = await addOSMobjects(true);
|
|
||||||
|
|
||||||
const closestObject = findClosestPolygon(objects, {
|
|
||||||
lat: contextMenu.lat,
|
|
||||||
lon: contextMenu.lng,
|
|
||||||
});
|
|
||||||
|
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
|
|
||||||
if (closestObject) {
|
|
||||||
toggleSearchElementSelection(closestObject.wayID, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
setMissionFormValues({
|
setMissionFormValues({
|
||||||
...missionFormValues,
|
...missionFormValues,
|
||||||
...parsed,
|
...parsed,
|
||||||
@@ -134,6 +122,17 @@ export const ContextMenu = () => {
|
|||||||
addressLng: contextMenu.lng,
|
addressLng: contextMenu.lng,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const objects = await addOSMobjects(true);
|
||||||
|
|
||||||
|
const closestObject = findClosestPolygon(objects, {
|
||||||
|
lat: contextMenu.lat,
|
||||||
|
lon: contextMenu.lng,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (closestObject) {
|
||||||
|
toggleSearchElementSelection(closestObject.wayID, true);
|
||||||
|
}
|
||||||
|
|
||||||
map.setView([contextMenu.lat, contextMenu.lng], 18, {
|
map.setView([contextMenu.lat, contextMenu.lng], 18, {
|
||||||
animate: true,
|
animate: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -337,10 +337,14 @@ const MissionMarker = ({ mission }: { mission: Mission }) => {
|
|||||||
return [
|
return [
|
||||||
editingMissionId === mission.id && missionFormValues?.addressLat
|
editingMissionId === mission.id && missionFormValues?.addressLat
|
||||||
? missionFormValues.addressLat
|
? missionFormValues.addressLat
|
||||||
: mission.addressLat,
|
: mission.hpgValidationState !== "POSITION_AMANDED" && mission.hpgLocationLat
|
||||||
|
? mission.hpgLocationLat
|
||||||
|
: mission.addressLat,
|
||||||
editingMissionId === mission.id && missionFormValues?.addressLng
|
editingMissionId === mission.id && missionFormValues?.addressLng
|
||||||
? missionFormValues.addressLng
|
? missionFormValues.addressLng
|
||||||
: mission.addressLng,
|
: mission.hpgValidationState !== "POSITION_AMANDED" && mission.hpgLocationLng
|
||||||
|
? mission.hpgLocationLng
|
||||||
|
: mission.addressLng,
|
||||||
];
|
];
|
||||||
}, [
|
}, [
|
||||||
editingMissionId,
|
editingMissionId,
|
||||||
|
|||||||
@@ -100,11 +100,17 @@ export default async function Page({ params }: { params: Promise<{ id: string }>
|
|||||||
if (!user) return <Error statusCode={404} title="User not found" />;
|
if (!user) return <Error statusCode={404} title="User not found" />;
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-6 gap-4">
|
<div className="grid grid-cols-6 gap-4">
|
||||||
<div className="col-span-full">
|
<div className="col-span-full flex justify-between items-center">
|
||||||
<p className="text-2xl font-semibold text-left flex items-center gap-2">
|
<p className="text-2xl font-semibold text-left flex items-center gap-2">
|
||||||
<PersonIcon className="w-5 h-5" />
|
<PersonIcon className="w-5 h-5" />
|
||||||
{user?.firstname} {user?.lastname} #{user?.publicId}
|
{user?.firstname} {user?.lastname} #{user?.publicId}
|
||||||
</p>
|
</p>
|
||||||
|
<p
|
||||||
|
className="text-sm text-gray-400 font-thin tooltip tooltip-left"
|
||||||
|
data-tip="Account erstellt am"
|
||||||
|
>
|
||||||
|
{new Date(user.createdAt).toLocaleString("de-DE")}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="card bg-base-200 shadow-xl mb-4 col-span-6 xl:col-span-3">
|
<div className="card bg-base-200 shadow-xl mb-4 col-span-6 xl:col-span-3">
|
||||||
<ProfileForm user={user} />
|
<ProfileForm user={user} />
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ export const Login = () => {
|
|||||||
Registrierung
|
Registrierung
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
<div className="alert alert-info alert-outline text-sm font-semibold text-center">
|
<div className="alert alert-info alert-outline text-sm font-semibold text-center justify-center">
|
||||||
Du warst bereits Nutzer der V1? <br />
|
Du warst bereits Nutzer der V1? <br />
|
||||||
Registriere dich mit der gleichen E-Mail, um deinen Account zu übernehmen!
|
Melde dich mit deinen alten Zugangsdaten an.
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5 mb-2">
|
<div className="mt-5 mb-2">
|
||||||
<label className="input input-bordered flex items-center gap-2 w-full">
|
<label className="input input-bordered flex items-center gap-2 w-full">
|
||||||
|
|||||||
@@ -94,9 +94,10 @@ export const Register = () => {
|
|||||||
Login
|
Login
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
<div className="alert alert-info alert-outline text-sm font-semibold text-center">
|
<div className="alert alert-info alert-outline text-sm font-semibold text-center justify-center">
|
||||||
Du warst bereits Nutzer der V1? <br />
|
Du warst bereits Nutzer der V1? <br />
|
||||||
Registriere dich mit der gleichen E-Mail, um deinen Account zu übernehmen!
|
Du musst keinen neuen Account erstellen, sondern kannst dich mit deinen alten Zugangsdaten
|
||||||
|
anmelden.
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5 mb-2">
|
<div className="mt-5 mb-2">
|
||||||
<label className="input input-bordered flex items-center gap-2 mt-2 w-full">
|
<label className="input input-bordered flex items-center gap-2 mt-2 w-full">
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ interface PaginatedTableProps<TData> extends Omit<SortableTableProps<TData>, "da
|
|||||||
showEditButton?: boolean;
|
showEditButton?: boolean;
|
||||||
searchFields?: string[];
|
searchFields?: string[];
|
||||||
include?: Record<string, boolean>;
|
include?: Record<string, boolean>;
|
||||||
|
strictQuery?: boolean;
|
||||||
leftOfSearch?: React.ReactNode;
|
leftOfSearch?: React.ReactNode;
|
||||||
rightOfSearch?: React.ReactNode;
|
rightOfSearch?: React.ReactNode;
|
||||||
leftOfPagination?: React.ReactNode;
|
leftOfPagination?: React.ReactNode;
|
||||||
@@ -30,6 +31,7 @@ export function PaginatedTable<TData>({
|
|||||||
filter,
|
filter,
|
||||||
include,
|
include,
|
||||||
ref,
|
ref,
|
||||||
|
strictQuery = false,
|
||||||
leftOfSearch,
|
leftOfSearch,
|
||||||
rightOfSearch,
|
rightOfSearch,
|
||||||
leftOfPagination,
|
leftOfPagination,
|
||||||
@@ -63,6 +65,15 @@ export function PaginatedTable<TData>({
|
|||||||
filter,
|
filter,
|
||||||
include,
|
include,
|
||||||
orderBy,
|
orderBy,
|
||||||
|
strictQuery
|
||||||
|
? restProps.columns
|
||||||
|
.filter((col: any) => "accessorKey" in col)
|
||||||
|
.map((col: any) => col.accessorKey)
|
||||||
|
.reduce((acc: Record<string, any>, key: string) => {
|
||||||
|
acc[key] = true;
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
: undefined,
|
||||||
).then((result) => {
|
).then((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
setData(result.data);
|
setData(result.data);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export async function getData(
|
|||||||
filter?: Record<string, any>,
|
filter?: Record<string, any>,
|
||||||
include?: Record<string, boolean>,
|
include?: Record<string, boolean>,
|
||||||
orderBy?: Record<string, "asc" | "desc">,
|
orderBy?: Record<string, "asc" | "desc">,
|
||||||
|
select?: Record<string, any>,
|
||||||
) {
|
) {
|
||||||
if (!model || !prisma[model]) {
|
if (!model || !prisma[model]) {
|
||||||
return { data: [], total: 0 };
|
return { data: [], total: 0 };
|
||||||
@@ -33,13 +34,13 @@ export async function getData(
|
|||||||
if (!prisma[model]) {
|
if (!prisma[model]) {
|
||||||
return { data: [], total: 0 };
|
return { data: [], total: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await (prisma[model] as any).findMany({
|
const data = await (prisma[model] as any).findMany({
|
||||||
where,
|
where,
|
||||||
orderBy,
|
orderBy,
|
||||||
take: limit,
|
take: limit,
|
||||||
skip: offset,
|
skip: offset,
|
||||||
include,
|
include,
|
||||||
|
select,
|
||||||
});
|
});
|
||||||
|
|
||||||
const total = await (prisma[model] as any).count({ where });
|
const total = await (prisma[model] as any).count({ where });
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { PaginatedTable } from "_components/PaginatedTable";
|
|||||||
export default function () {
|
export default function () {
|
||||||
return (
|
return (
|
||||||
<PaginatedTable
|
<PaginatedTable
|
||||||
|
strictQuery
|
||||||
searchFields={["firstname", "lastname", "vatsimCid"]}
|
searchFields={["firstname", "lastname", "vatsimCid"]}
|
||||||
prismaModel={"user"}
|
prismaModel={"user"}
|
||||||
filter={{
|
filter={{
|
||||||
|
|||||||
Reference in New Issue
Block a user