62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { PUBLIC_GMAPS_API_KEY } from "$env/static/public";
|
|
import type { Database } from "./database.d.ts";
|
|
|
|
export type Table<T extends keyof Database["public"]["Tables"]> =
|
|
Database["public"]["Tables"][T]["Row"];
|
|
export type Enum<T extends keyof Database["public"]["Enums"]> = Database["public"]["Enums"][T];
|
|
|
|
export const availableStudySpaceTags = [
|
|
"Crowded",
|
|
"Group study",
|
|
"Food allowed",
|
|
"No food allowed",
|
|
"Well lit",
|
|
"Poorly lit",
|
|
"Whiteboard",
|
|
"Restricted access",
|
|
"Hot",
|
|
"Air conditioned",
|
|
"Cold",
|
|
"PCs",
|
|
"Cringe"
|
|
];
|
|
|
|
export const volumeTags = ["Silent", "Some Noise", "Loud"];
|
|
export const wifiTags = ["Good WiFi", "Moderate WiFi", "Bad/No WiFi"];
|
|
export const powerOutletTags = ["Many Outlets", "Some Outlets", "No Outlets"];
|
|
|
|
export const allTags = [...availableStudySpaceTags, ...volumeTags, ...wifiTags, ...powerOutletTags];
|
|
|
|
export const reportTypes = [
|
|
"Inappropriate content",
|
|
"Duplicate content",
|
|
"Incorrect content",
|
|
"Other"
|
|
];
|
|
|
|
export async function gmapsLoader() {
|
|
const { Loader } = await import("@googlemaps/js-api-loader");
|
|
return new Loader({
|
|
apiKey: PUBLIC_GMAPS_API_KEY,
|
|
version: "weekly",
|
|
libraries: ["places"]
|
|
});
|
|
}
|
|
|
|
export function formatTime(time: string) {
|
|
const [h, m] = time.split(":").map(Number);
|
|
const date = new Date();
|
|
date.setHours(h, m);
|
|
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
}
|
|
|
|
export const daysOfWeek = [
|
|
"Sunday",
|
|
"Monday",
|
|
"Tuesday",
|
|
"Wednesday",
|
|
"Thursday",
|
|
"Friday",
|
|
"Saturday"
|
|
];
|