feat(create-turbo): apply official-starter transform

This commit is contained in:
Turbobot 2025-02-08 17:04:20 -08:00 committed by ryan
parent 91411a6083
commit 9be2282943
51 changed files with 14526 additions and 26 deletions

View File

@ -1,27 +1,31 @@
import spacetime from "spacetime";
import { createClient } from '@/utils/supabase/server';
import RealtimeDayPage from "./realtime";
export default async function DayPage(
{ date }: { date: string }
{ params }: { params: { date: string } }
) {
const supabase = await createClient();
const date = (await params).date;
const { data: { user: user } } = await supabase.auth.getUser();
const { data: day } = await supabase
.from('days')
.select('*')
.select(`*,
hours(*,
category:categories(id,
code,
name,
color:colors(name, hexcode, inverse)
)
)
`)
.eq('date', date)
.eq('userId', user?.id)
.limit(1).single()
;
return !day ? <div>Loading...</div> : (
<>
<h1>{spacetime(day.date).format('{month} {date-ordinal}, {year}')}</h1>
<ul>
<li>{day.mood}</li>
<li>{day.comment}</li>
</ul>
</>
<RealtimeDayPage initialDay={day} />
);
}

View File

@ -0,0 +1,64 @@
'use client';
import { createClient } from "@/utils/supabase/client";
import { useEffect, useState } from "react";
import spacetime from "spacetime";
const supabase = createClient();
export default function RealtimeDayPage({ initialDay }) {
const [day, setDay] = useState(initialDay);
useEffect(() => {
if (initialDay && !day) {
setDay(initialDay);
}
}, [initialDay]);
useEffect(() => {
const daysChannel = supabase.channel('days')
.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'days' }, (payload) => {
setDay(payload.new);
}).subscribe();
const hoursChannel = supabase.channel('hours')
.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'hours' }, (payload) => {
const updatedHour = payload.new;
const prevHours = day.hours;
const newHours = prevHours.map((hour) => {
if (hour.id === updatedHour.id) {
return updatedHour;
}
return hour;
});
const newDay = { ...day, hours: newHours };
console.log(newDay);
setDay(newDay);
}).subscribe();
return () => {
daysChannel.unsubscribe();
hoursChannel.unsubscribe();
}
}, [supabase])
return (
<>
<h1>{spacetime(day.date).format('{month} {date-ordinal}, {year}')}</h1>
<ul>
<li>MOOD: {day.mood ?? "No mood set."}</li>
<li>COMMENT: {day.comment ?? "No comment yet."}</li>
</ul>
<ul>
{day.hours.map((hour) => (
<li key={hour.id}
className="p-2"
style={{
"backgroundColor": hour.category?.color?.hexcode,
"color": hour.category?.color?.inverse
}}>[{spacetime(hour.datetime).format('{time}')}] {hour.comment}</li>
))}
</ul>
</>
)
}

View File

@ -14,8 +14,8 @@ const defaultUrl = process.env.VERCEL_URL
export const metadata = {
metadataBase: new URL(defaultUrl),
title: "Next.js and Supabase Starter Kit",
description: "The fastest way to build apps with Next.js and Supabase",
title: "Nazara",
description: "The all in one life tracking app.",
};
const geistSans = Geist({

177
nazara/apps/web/lib/schemas.d.ts vendored Normal file
View File

@ -0,0 +1,177 @@
/*
* ==========================================
* | GENERATED BY SUPAZOD |
* ==========================================
*/
import { z } from "zod";
import * as generated from "./schemas";
export type Json = z.infer<typeof generated.jsonSchema>;
export type PublicApikeyRowSchema = z.infer<
typeof generated.publicApikeyRowSchemaSchema
>;
export type PublicApikeyInsertSchema = z.infer<
typeof generated.publicApikeyInsertSchemaSchema
>;
export type PublicApikeyUpdateSchema = z.infer<
typeof generated.publicApikeyUpdateSchemaSchema
>;
export type PublicApikeyRelationshipsSchema = z.infer<
typeof generated.publicApikeyRelationshipsSchemaSchema
>;
export type PublicCategoriesRowSchema = z.infer<
typeof generated.publicCategoriesRowSchemaSchema
>;
export type PublicCategoriesInsertSchema = z.infer<
typeof generated.publicCategoriesInsertSchemaSchema
>;
export type PublicCategoriesUpdateSchema = z.infer<
typeof generated.publicCategoriesUpdateSchemaSchema
>;
export type PublicCategoriesRelationshipsSchema = z.infer<
typeof generated.publicCategoriesRelationshipsSchemaSchema
>;
export type PublicColorsRowSchema = z.infer<
typeof generated.publicColorsRowSchemaSchema
>;
export type PublicColorsInsertSchema = z.infer<
typeof generated.publicColorsInsertSchemaSchema
>;
export type PublicColorsUpdateSchema = z.infer<
typeof generated.publicColorsUpdateSchemaSchema
>;
export type PublicColorsRelationshipsSchema = z.infer<
typeof generated.publicColorsRelationshipsSchemaSchema
>;
export type PublicDaysRowSchema = z.infer<
typeof generated.publicDaysRowSchemaSchema
>;
export type PublicDaysInsertSchema = z.infer<
typeof generated.publicDaysInsertSchemaSchema
>;
export type PublicDaysUpdateSchema = z.infer<
typeof generated.publicDaysUpdateSchemaSchema
>;
export type PublicDaysRelationshipsSchema = z.infer<
typeof generated.publicDaysRelationshipsSchemaSchema
>;
export type PublicHoursRowSchema = z.infer<
typeof generated.publicHoursRowSchemaSchema
>;
export type PublicHoursInsertSchema = z.infer<
typeof generated.publicHoursInsertSchemaSchema
>;
export type PublicHoursUpdateSchema = z.infer<
typeof generated.publicHoursUpdateSchemaSchema
>;
export type PublicHoursRelationshipsSchema = z.infer<
typeof generated.publicHoursRelationshipsSchemaSchema
>;
export type PublicMeasurementsRowSchema = z.infer<
typeof generated.publicMeasurementsRowSchemaSchema
>;
export type PublicMeasurementsInsertSchema = z.infer<
typeof generated.publicMeasurementsInsertSchemaSchema
>;
export type PublicMeasurementsUpdateSchema = z.infer<
typeof generated.publicMeasurementsUpdateSchemaSchema
>;
export type PublicMeasurementsRelationshipsSchema = z.infer<
typeof generated.publicMeasurementsRelationshipsSchemaSchema
>;
export type PublicMetricsRowSchema = z.infer<
typeof generated.publicMetricsRowSchemaSchema
>;
export type PublicMetricsInsertSchema = z.infer<
typeof generated.publicMetricsInsertSchemaSchema
>;
export type PublicMetricsUpdateSchema = z.infer<
typeof generated.publicMetricsUpdateSchemaSchema
>;
export type PublicMetricsRelationshipsSchema = z.infer<
typeof generated.publicMetricsRelationshipsSchemaSchema
>;
export type PublicSbCategoriesRowSchema = z.infer<
typeof generated.publicSbCategoriesRowSchemaSchema
>;
export type PublicSbCategoriesInsertSchema = z.infer<
typeof generated.publicSbCategoriesInsertSchemaSchema
>;
export type PublicSbCategoriesUpdateSchema = z.infer<
typeof generated.publicSbCategoriesUpdateSchemaSchema
>;
export type PublicSbCategoriesRelationshipsSchema = z.infer<
typeof generated.publicSbCategoriesRelationshipsSchemaSchema
>;
export type PublicSbColorsRowSchema = z.infer<
typeof generated.publicSbColorsRowSchemaSchema
>;
export type PublicSbColorsInsertSchema = z.infer<
typeof generated.publicSbColorsInsertSchemaSchema
>;
export type PublicSbColorsUpdateSchema = z.infer<
typeof generated.publicSbColorsUpdateSchemaSchema
>;
export type PublicSbColorsRelationshipsSchema = z.infer<
typeof generated.publicSbColorsRelationshipsSchemaSchema
>;
export type PublicSbDaysRowSchema = z.infer<
typeof generated.publicSbDaysRowSchemaSchema
>;
export type PublicSbDaysInsertSchema = z.infer<
typeof generated.publicSbDaysInsertSchemaSchema
>;
export type PublicSbDaysUpdateSchema = z.infer<
typeof generated.publicSbDaysUpdateSchemaSchema
>;
export type PublicSbDaysRelationshipsSchema = z.infer<
typeof generated.publicSbDaysRelationshipsSchemaSchema
>;
export type PublicSbHoursRowSchema = z.infer<
typeof generated.publicSbHoursRowSchemaSchema
>;
export type PublicSbHoursInsertSchema = z.infer<
typeof generated.publicSbHoursInsertSchemaSchema
>;
export type PublicSbHoursUpdateSchema = z.infer<
typeof generated.publicSbHoursUpdateSchemaSchema
>;
export type PublicSbHoursRelationshipsSchema = z.infer<
typeof generated.publicSbHoursRelationshipsSchemaSchema
>;
export type PublicSbMeasurementsRowSchema = z.infer<
typeof generated.publicSbMeasurementsRowSchemaSchema
>;
export type PublicSbMeasurementsInsertSchema = z.infer<
typeof generated.publicSbMeasurementsInsertSchemaSchema
>;
export type PublicSbMeasurementsUpdateSchema = z.infer<
typeof generated.publicSbMeasurementsUpdateSchemaSchema
>;
export type PublicSbMeasurementsRelationshipsSchema = z.infer<
typeof generated.publicSbMeasurementsRelationshipsSchemaSchema
>;
export type PublicSbMetricsRowSchema = z.infer<
typeof generated.publicSbMetricsRowSchemaSchema
>;
export type PublicSbMetricsInsertSchema = z.infer<
typeof generated.publicSbMetricsInsertSchemaSchema
>;
export type PublicSbMetricsUpdateSchema = z.infer<
typeof generated.publicSbMetricsUpdateSchemaSchema
>;
export type PublicSbMetricsRelationshipsSchema = z.infer<
typeof generated.publicSbMetricsRelationshipsSchemaSchema
>;
export type PublicUserRowSchema = z.infer<
typeof generated.publicUserRowSchemaSchema
>;
export type PublicUserInsertSchema = z.infer<
typeof generated.publicUserInsertSchemaSchema
>;
export type PublicUserUpdateSchema = z.infer<
typeof generated.publicUserUpdateSchemaSchema
>;
export type PublicUserRelationshipsSchema = z.infer<
typeof generated.publicUserRelationshipsSchemaSchema
>;

View File

@ -0,0 +1,549 @@
/*
* ==========================================
* | GENERATED BY SUPAZOD |
* ==========================================
*/
import { z } from "zod";
import { Json } from "./types";
export const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z
.union([
z.string(),
z.number(),
z.boolean(),
z.record(z.union([jsonSchema, z.undefined()])),
z.array(jsonSchema),
])
.nullable(),
);
export const publicApikeyRowSchemaSchema = z.object({
createdAt: z.string(),
id: z.string(),
keyHash: z.string(),
keyId: z.string(),
name: z.string(),
userId: z.string().nullable(),
});
export const publicApikeyInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
id: z.string(),
keyHash: z.string(),
keyId: z.string(),
name: z.string(),
userId: z.string().optional().nullable(),
});
export const publicApikeyUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
id: z.string().optional(),
keyHash: z.string().optional(),
keyId: z.string().optional(),
name: z.string().optional(),
userId: z.string().optional().nullable(),
});
export const publicApikeyRelationshipsSchemaSchema = z.tuple([]);
export const publicCategoriesRowSchemaSchema = z.object({
code: z.number(),
colorId: z.string(),
createdAt: z.string(),
description: z.string().nullable(),
id: z.string(),
name: z.string(),
parentId: z.string().nullable(),
userId: z.string().nullable(),
});
export const publicCategoriesInsertSchemaSchema = z.object({
code: z.number(),
colorId: z.string(),
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
id: z.string(),
name: z.string(),
parentId: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicCategoriesUpdateSchemaSchema = z.object({
code: z.number().optional(),
colorId: z.string().optional(),
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
id: z.string().optional(),
name: z.string().optional(),
parentId: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicCategoriesRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("category_colorId_color_id_fk"),
columns: z.tuple([z.literal("colorId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("colors"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("category_parentId_category_id_fk"),
columns: z.tuple([z.literal("parentId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("categories"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicColorsRowSchemaSchema = z.object({
createdAt: z.string(),
hexcode: z.string(),
id: z.string(),
inverse: z.string().nullable(),
name: z.string(),
userId: z.string().nullable(),
});
export const publicColorsInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
hexcode: z.string(),
id: z.string(),
inverse: z.string().optional().nullable(),
name: z.string(),
userId: z.string().optional().nullable(),
});
export const publicColorsUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
hexcode: z.string().optional(),
id: z.string().optional(),
inverse: z.string().optional().nullable(),
name: z.string().optional(),
userId: z.string().optional().nullable(),
});
export const publicColorsRelationshipsSchemaSchema = z.tuple([]);
export const publicDaysRowSchemaSchema = z.object({
comment: z.string().nullable(),
date: z.string(),
id: z.string(),
mood: z.number().nullable(),
userId: z.string().nullable(),
});
export const publicDaysInsertSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string(),
id: z.string(),
mood: z.number().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicDaysUpdateSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string().optional(),
id: z.string().optional(),
mood: z.number().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicDaysRelationshipsSchemaSchema = z.tuple([]);
export const publicHoursRowSchemaSchema = z.object({
categoryId: z.string().nullable(),
comment: z.string().nullable(),
createdAt: z.string(),
datetime: z.string().nullable(),
dayId: z.string(),
id: z.string(),
userId: z.string().nullable(),
});
export const publicHoursInsertSchemaSchema = z.object({
categoryId: z.string().optional().nullable(),
comment: z.string().optional().nullable(),
createdAt: z.string().optional(),
datetime: z.string().optional().nullable(),
dayId: z.string(),
id: z.string(),
userId: z.string().optional().nullable(),
});
export const publicHoursUpdateSchemaSchema = z.object({
categoryId: z.string().optional().nullable(),
comment: z.string().optional().nullable(),
createdAt: z.string().optional(),
datetime: z.string().optional().nullable(),
dayId: z.string().optional(),
id: z.string().optional(),
userId: z.string().optional().nullable(),
});
export const publicHoursRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("hour_categoryId_category_id_fk"),
columns: z.tuple([z.literal("categoryId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("categories"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("hour_dayId_day_id_fk"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicMeasurementsRowSchemaSchema = z.object({
createdAt: z.string(),
dayId: z.string(),
hourId: z.string().nullable(),
id: z.string(),
metricId: z.string(),
userId: z.string().nullable(),
value: z.string(),
});
export const publicMeasurementsInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
dayId: z.string(),
hourId: z.string().optional().nullable(),
id: z.string(),
metricId: z.string(),
userId: z.string().optional().nullable(),
value: z.string(),
});
export const publicMeasurementsUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
dayId: z.string().optional(),
hourId: z.string().optional().nullable(),
id: z.string().optional(),
metricId: z.string().optional(),
userId: z.string().optional().nullable(),
value: z.string().optional(),
});
export const publicMeasurementsRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("measurement_dayId_day_id_fk"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurement_hourId_hour_id_fk"),
columns: z.tuple([z.literal("hourId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("hours"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurement_metricId_metric_id_fk"),
columns: z.tuple([z.literal("metricId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("metrics"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicMetricsRowSchemaSchema = z.object({
createdAt: z.string(),
description: z.string().nullable(),
goal: z.number().nullable(),
icon: z.string(),
id: z.string(),
name: z.string(),
type: z.string(),
unit: z.string().nullable(),
userId: z.string().nullable(),
});
export const publicMetricsInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string(),
id: z.string(),
name: z.string(),
type: z.string(),
unit: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicMetricsUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string().optional(),
id: z.string().optional(),
name: z.string().optional(),
type: z.string().optional(),
unit: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicMetricsRelationshipsSchemaSchema = z.tuple([]);
export const publicSbCategoriesRowSchemaSchema = z.object({
code: z.number(),
colorId: z.number(),
created_at: z.string(),
id: z.number(),
name: z.string(),
userId: z.string(),
});
export const publicSbCategoriesInsertSchemaSchema = z.object({
code: z.number(),
colorId: z.number(),
created_at: z.string().optional(),
id: z.number().optional(),
name: z.string(),
userId: z.string(),
});
export const publicSbCategoriesUpdateSchemaSchema = z.object({
code: z.number().optional(),
colorId: z.number().optional(),
created_at: z.string().optional(),
id: z.number().optional(),
name: z.string().optional(),
userId: z.string().optional(),
});
export const publicSbCategoriesRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("categories_colorId_fkey"),
columns: z.tuple([z.literal("colorId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_colors"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicSbColorsRowSchemaSchema = z.object({
hexcode: z.string(),
id: z.number(),
inverse: z.string(),
name: z.string(),
userId: z.string(),
});
export const publicSbColorsInsertSchemaSchema = z.object({
hexcode: z.string(),
id: z.number().optional(),
inverse: z.string(),
name: z.string(),
userId: z.string(),
});
export const publicSbColorsUpdateSchemaSchema = z.object({
hexcode: z.string().optional(),
id: z.number().optional(),
inverse: z.string().optional(),
name: z.string().optional(),
userId: z.string().optional(),
});
export const publicSbColorsRelationshipsSchemaSchema = z.tuple([]);
export const publicSbDaysRowSchemaSchema = z.object({
comment: z.string().nullable(),
date: z.string(),
id: z.number(),
mood: z.number().nullable(),
userId: z.string(),
});
export const publicSbDaysInsertSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string(),
id: z.number().optional(),
mood: z.number().optional().nullable(),
userId: z.string(),
});
export const publicSbDaysUpdateSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string().optional(),
id: z.number().optional(),
mood: z.number().optional().nullable(),
userId: z.string().optional(),
});
export const publicSbDaysRelationshipsSchemaSchema = z.tuple([]);
export const publicSbHoursRowSchemaSchema = z.object({
categoryId: z.number().nullable(),
comment: z.string().nullable(),
datetime: z.string(),
dayId: z.number(),
id: z.number(),
userId: z.string().nullable(),
});
export const publicSbHoursInsertSchemaSchema = z.object({
categoryId: z.number().optional().nullable(),
comment: z.string().optional().nullable(),
datetime: z.string(),
dayId: z.number(),
id: z.number().optional(),
userId: z.string().optional().nullable(),
});
export const publicSbHoursUpdateSchemaSchema = z.object({
categoryId: z.number().optional().nullable(),
comment: z.string().optional().nullable(),
datetime: z.string().optional(),
dayId: z.number().optional(),
id: z.number().optional(),
userId: z.string().optional().nullable(),
});
export const publicSbHoursRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("hours_dayId_fkey"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicSbMeasurementsRowSchemaSchema = z.object({
created_at: z.string(),
dayId: z.number().nullable(),
hourId: z.number().nullable(),
id: z.number(),
metricId: z.number().nullable(),
type: z.string(),
userId: z.string().nullable(),
value: z.string(),
});
export const publicSbMeasurementsInsertSchemaSchema = z.object({
created_at: z.string().optional(),
dayId: z.number().optional().nullable(),
hourId: z.number().optional().nullable(),
id: z.number().optional(),
metricId: z.number().optional().nullable(),
type: z.string().optional(),
userId: z.string().optional().nullable(),
value: z.string(),
});
export const publicSbMeasurementsUpdateSchemaSchema = z.object({
created_at: z.string().optional(),
dayId: z.number().optional().nullable(),
hourId: z.number().optional().nullable(),
id: z.number().optional(),
metricId: z.number().optional().nullable(),
type: z.string().optional(),
userId: z.string().optional().nullable(),
value: z.string().optional(),
});
export const publicSbMeasurementsRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("measurements_dayId_fkey"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurements_hourId_fkey"),
columns: z.tuple([z.literal("hourId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_hours"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurements_metricId_fkey"),
columns: z.tuple([z.literal("metricId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_metrics"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicSbMetricsRowSchemaSchema = z.object({
created_at: z.string(),
description: z.string().nullable(),
goal: z.number().nullable(),
icon: z.string(),
id: z.number(),
name: z.string(),
type: z.string(),
unit: z.string().nullable(),
userId: z.string(),
});
export const publicSbMetricsInsertSchemaSchema = z.object({
created_at: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string(),
id: z.number().optional(),
name: z.string(),
type: z.string(),
unit: z.string().optional().nullable(),
userId: z.string(),
});
export const publicSbMetricsUpdateSchemaSchema = z.object({
created_at: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string().optional(),
id: z.number().optional(),
name: z.string().optional(),
type: z.string().optional(),
unit: z.string().optional().nullable(),
userId: z.string().optional(),
});
export const publicSbMetricsRelationshipsSchemaSchema = z.tuple([]);
export const publicUserRowSchemaSchema = z.object({
email: z.string(),
emailVerified: z.number().nullable(),
id: z.string(),
image: z.string().nullable(),
name: z.string(),
password: z.string().nullable(),
role: z.string().nullable(),
timezone: z.string(),
});
export const publicUserInsertSchemaSchema = z.object({
email: z.string(),
emailVerified: z.number().optional().nullable(),
id: z.string(),
image: z.string().optional().nullable(),
name: z.string(),
password: z.string().optional().nullable(),
role: z.string().optional().nullable(),
timezone: z.string().optional(),
});
export const publicUserUpdateSchemaSchema = z.object({
email: z.string().optional(),
emailVerified: z.number().optional().nullable(),
id: z.string().optional(),
image: z.string().optional().nullable(),
name: z.string().optional(),
password: z.string().optional().nullable(),
role: z.string().optional().nullable(),
timezone: z.string().optional(),
});
export const publicUserRelationshipsSchemaSchema = z.tuple([]);

View File

@ -0,0 +1,624 @@
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]
export type Database = {
public: {
Tables: {
apiKey: {
Row: {
createdAt: string
id: string
keyHash: string
keyId: string
name: string
userId: string | null
}
Insert: {
createdAt?: string
id: string
keyHash: string
keyId: string
name: string
userId?: string | null
}
Update: {
createdAt?: string
id?: string
keyHash?: string
keyId?: string
name?: string
userId?: string | null
}
Relationships: []
}
categories: {
Row: {
code: number
colorId: string
createdAt: string
description: string | null
id: string
name: string
parentId: string | null
userId: string | null
}
Insert: {
code: number
colorId: string
createdAt?: string
description?: string | null
id: string
name: string
parentId?: string | null
userId?: string | null
}
Update: {
code?: number
colorId?: string
createdAt?: string
description?: string | null
id?: string
name?: string
parentId?: string | null
userId?: string | null
}
Relationships: [
{
foreignKeyName: "category_colorId_color_id_fk"
columns: ["colorId"]
isOneToOne: false
referencedRelation: "colors"
referencedColumns: ["id"]
},
{
foreignKeyName: "category_parentId_category_id_fk"
columns: ["parentId"]
isOneToOne: false
referencedRelation: "categories"
referencedColumns: ["id"]
},
]
}
colors: {
Row: {
createdAt: string
hexcode: string
id: string
inverse: string | null
name: string
userId: string | null
}
Insert: {
createdAt?: string
hexcode: string
id: string
inverse?: string | null
name: string
userId?: string | null
}
Update: {
createdAt?: string
hexcode?: string
id?: string
inverse?: string | null
name?: string
userId?: string | null
}
Relationships: []
}
days: {
Row: {
comment: string | null
date: string
id: string
mood: number | null
userId: string | null
}
Insert: {
comment?: string | null
date: string
id: string
mood?: number | null
userId?: string | null
}
Update: {
comment?: string | null
date?: string
id?: string
mood?: number | null
userId?: string | null
}
Relationships: []
}
hours: {
Row: {
categoryId: string | null
comment: string | null
createdAt: string
datetime: string | null
dayId: string
id: string
userId: string | null
}
Insert: {
categoryId?: string | null
comment?: string | null
createdAt?: string
datetime?: string | null
dayId: string
id: string
userId?: string | null
}
Update: {
categoryId?: string | null
comment?: string | null
createdAt?: string
datetime?: string | null
dayId?: string
id?: string
userId?: string | null
}
Relationships: [
{
foreignKeyName: "hour_categoryId_category_id_fk"
columns: ["categoryId"]
isOneToOne: false
referencedRelation: "categories"
referencedColumns: ["id"]
},
{
foreignKeyName: "hour_dayId_day_id_fk"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "days"
referencedColumns: ["id"]
},
]
}
measurements: {
Row: {
createdAt: string
dayId: string
hourId: string | null
id: string
metricId: string
userId: string | null
value: string
}
Insert: {
createdAt?: string
dayId: string
hourId?: string | null
id: string
metricId: string
userId?: string | null
value: string
}
Update: {
createdAt?: string
dayId?: string
hourId?: string | null
id?: string
metricId?: string
userId?: string | null
value?: string
}
Relationships: [
{
foreignKeyName: "measurement_dayId_day_id_fk"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "days"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurement_hourId_hour_id_fk"
columns: ["hourId"]
isOneToOne: false
referencedRelation: "hours"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurement_metricId_metric_id_fk"
columns: ["metricId"]
isOneToOne: false
referencedRelation: "metrics"
referencedColumns: ["id"]
},
]
}
metrics: {
Row: {
createdAt: string
description: string | null
goal: number | null
icon: string
id: string
name: string
type: string
unit: string | null
userId: string | null
}
Insert: {
createdAt?: string
description?: string | null
goal?: number | null
icon: string
id: string
name: string
type: string
unit?: string | null
userId?: string | null
}
Update: {
createdAt?: string
description?: string | null
goal?: number | null
icon?: string
id?: string
name?: string
type?: string
unit?: string | null
userId?: string | null
}
Relationships: []
}
sb_categories: {
Row: {
code: number
colorId: number
created_at: string
id: number
name: string
userId: string
}
Insert: {
code: number
colorId: number
created_at?: string
id?: number
name: string
userId: string
}
Update: {
code?: number
colorId?: number
created_at?: string
id?: number
name?: string
userId?: string
}
Relationships: [
{
foreignKeyName: "categories_colorId_fkey"
columns: ["colorId"]
isOneToOne: false
referencedRelation: "sb_colors"
referencedColumns: ["id"]
},
]
}
sb_colors: {
Row: {
hexcode: string
id: number
inverse: string
name: string
userId: string
}
Insert: {
hexcode: string
id?: number
inverse: string
name: string
userId: string
}
Update: {
hexcode?: string
id?: number
inverse?: string
name?: string
userId?: string
}
Relationships: []
}
sb_days: {
Row: {
comment: string | null
date: string
id: number
mood: number | null
userId: string
}
Insert: {
comment?: string | null
date: string
id?: number
mood?: number | null
userId: string
}
Update: {
comment?: string | null
date?: string
id?: number
mood?: number | null
userId?: string
}
Relationships: []
}
sb_hours: {
Row: {
categoryId: number | null
comment: string | null
datetime: string
dayId: number
id: number
userId: string | null
}
Insert: {
categoryId?: number | null
comment?: string | null
datetime: string
dayId: number
id?: number
userId?: string | null
}
Update: {
categoryId?: number | null
comment?: string | null
datetime?: string
dayId?: number
id?: number
userId?: string | null
}
Relationships: [
{
foreignKeyName: "hours_dayId_fkey"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "sb_days"
referencedColumns: ["id"]
},
]
}
sb_measurements: {
Row: {
created_at: string
dayId: number | null
hourId: number | null
id: number
metricId: number | null
type: string
userId: string | null
value: string
}
Insert: {
created_at?: string
dayId?: number | null
hourId?: number | null
id?: number
metricId?: number | null
type?: string
userId?: string | null
value: string
}
Update: {
created_at?: string
dayId?: number | null
hourId?: number | null
id?: number
metricId?: number | null
type?: string
userId?: string | null
value?: string
}
Relationships: [
{
foreignKeyName: "measurements_dayId_fkey"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "sb_days"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurements_hourId_fkey"
columns: ["hourId"]
isOneToOne: false
referencedRelation: "sb_hours"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurements_metricId_fkey"
columns: ["metricId"]
isOneToOne: false
referencedRelation: "sb_metrics"
referencedColumns: ["id"]
},
]
}
sb_metrics: {
Row: {
created_at: string
description: string | null
goal: number | null
icon: string
id: number
name: string
type: string
unit: string | null
userId: string
}
Insert: {
created_at?: string
description?: string | null
goal?: number | null
icon: string
id?: number
name: string
type: string
unit?: string | null
userId: string
}
Update: {
created_at?: string
description?: string | null
goal?: number | null
icon?: string
id?: number
name?: string
type?: string
unit?: string | null
userId?: string
}
Relationships: []
}
user: {
Row: {
email: string
emailVerified: number | null
id: string
image: string | null
name: string
password: string | null
role: string | null
timezone: string
}
Insert: {
email: string
emailVerified?: number | null
id: string
image?: string | null
name: string
password?: string | null
role?: string | null
timezone?: string
}
Update: {
email?: string
emailVerified?: number | null
id?: string
image?: string | null
name?: string
password?: string | null
role?: string | null
timezone?: string
}
Relationships: []
}
}
Views: {
[_ in never]: never
}
Functions: {
[_ in never]: never
}
Enums: {
[_ in never]: never
}
CompositeTypes: {
[_ in never]: never
}
}
}
type PublicSchema = Database[Extract<keyof Database, "public">]
export type Tables<
PublicTableNameOrOptions extends
| keyof (PublicSchema["Tables"] & PublicSchema["Views"])
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
Row: infer R
}
? R
: never
: PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
PublicSchema["Views"])
? (PublicSchema["Tables"] &
PublicSchema["Views"])[PublicTableNameOrOptions] extends {
Row: infer R
}
? R
: never
: never
export type TablesInsert<
PublicTableNameOrOptions extends
| keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Insert: infer I
}
? I
: never
: PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
Insert: infer I
}
? I
: never
: never
export type TablesUpdate<
PublicTableNameOrOptions extends
| keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Update: infer U
}
? U
: never
: PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
Update: infer U
}
? U
: never
: never
export type Enums<
PublicEnumNameOrOptions extends
| keyof PublicSchema["Enums"]
| { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
: never = never,
> = PublicEnumNameOrOptions extends { schema: keyof Database }
? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
: PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
? PublicSchema["Enums"][PublicEnumNameOrOptions]
: never
export type CompositeTypes<
PublicCompositeTypeNameOrOptions extends
| keyof PublicSchema["CompositeTypes"]
| { schema: keyof Database },
CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
schema: keyof Database
}
? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
: never = never,
> = PublicCompositeTypeNameOrOptions extends { schema: keyof Database }
? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
: PublicCompositeTypeNameOrOptions extends keyof PublicSchema["CompositeTypes"]
? PublicSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
: never

View File

@ -22,13 +22,15 @@
"prettier": "^3.3.3",
"react": "19.0.0",
"react-dom": "19.0.0",
"spacetime": "^7.7.0"
"spacetime": "^7.7.0",
"supabase": "^2.9.6"
},
"devDependencies": {
"@types/node": "22.10.2",
"@types/react": "^19.0.2",
"@types/react-dom": "19.0.2",
"postcss": "8.4.49",
"supazod": "^1.1.2",
"tailwind-merge": "^2.5.2",
"tailwindcss": "3.4.17",
"tailwindcss-animate": "^1.0.7",

8
nazara/apps/web/supabase/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Supabase
.branches
.temp
# dotenvx
.env.keys
.env.local
.env.*.local

View File

@ -0,0 +1,281 @@
# For detailed configuration reference documentation, visit:
# https://supabase.com/docs/guides/local-development/cli/config
# A string used to distinguish different Supabase projects on the same host. Defaults to the
# working directory name when running `supabase init`.
project_id = "web"
[api]
enabled = true
# Port to use for the API URL.
port = 54321
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
# endpoints. `public` and `graphql_public` schemas are included by default.
schemas = ["public", "graphql_public"]
# Extra schemas to add to the search_path of every request.
extra_search_path = ["public", "extensions"]
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
# for accidental or malicious requests.
max_rows = 1000
[api.tls]
# Enable HTTPS endpoints locally using a self-signed certificate.
enabled = false
[db]
# Port to use for the local database URL.
port = 54322
# Port used by db diff command to initialize the shadow database.
shadow_port = 54320
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
# server_version;` on the remote database to check.
major_version = 15
[db.pooler]
enabled = false
# Port to use for the local connection pooler.
port = 54329
# Specifies when a server connection can be reused by other clients.
# Configure one of the supported pooler modes: `transaction`, `session`.
pool_mode = "transaction"
# How many server connections to allow per user/database pair.
default_pool_size = 20
# Maximum number of client connections allowed.
max_client_conn = 100
[db.seed]
# If enabled, seeds the database after migrations during a db reset.
enabled = true
# Specifies an ordered list of seed files to load during db reset.
# Supports glob patterns relative to supabase directory: "./seeds/*.sql"
sql_paths = ["./seed.sql"]
[realtime]
enabled = true
# Bind realtime via either IPv4 or IPv6. (default: IPv4)
# ip_version = "IPv6"
# The maximum length in bytes of HTTP request headers. (default: 4096)
# max_header_length = 4096
[studio]
enabled = true
# Port to use for Supabase Studio.
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://127.0.0.1"
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"
# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
[inbucket]
enabled = true
# Port to use for the email testing server web interface.
port = 54324
# Uncomment to expose additional ports for testing user applications that send emails.
# smtp_port = 54325
# pop3_port = 54326
# admin_email = "admin@email.com"
# sender_name = "Admin"
[storage]
enabled = true
# The maximum file size allowed (e.g. "5MB", "500KB").
file_size_limit = "50MiB"
# Image transformation API is available to Supabase Pro plan.
# [storage.image_transformation]
# enabled = true
# Uncomment to configure local storage buckets
# [storage.buckets.images]
# public = false
# file_size_limit = "50MiB"
# allowed_mime_types = ["image/png", "image/jpeg"]
# objects_path = "./images"
[auth]
enabled = true
# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
# in emails.
site_url = "http://127.0.0.1:3000"
# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
additional_redirect_urls = ["https://127.0.0.1:3000"]
# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).
jwt_expiry = 3600
# If disabled, the refresh token will never expire.
enable_refresh_token_rotation = true
# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.
# Requires enable_refresh_token_rotation = true.
refresh_token_reuse_interval = 10
# Allow/disallow new user signups to your project.
enable_signup = true
# Allow/disallow anonymous sign-ins to your project.
enable_anonymous_sign_ins = false
# Allow/disallow testing manual linking of accounts
enable_manual_linking = false
# Passwords shorter than this value will be rejected as weak. Minimum 6, recommended 8 or more.
minimum_password_length = 6
# Passwords that do not meet the following requirements will be rejected as weak. Supported values
# are: `letters_digits`, `lower_upper_letters_digits`, `lower_upper_letters_digits_symbols`
password_requirements = ""
[auth.email]
# Allow/disallow new user signups via email to your project.
enable_signup = true
# If enabled, a user will be required to confirm any email change on both the old, and new email
# addresses. If disabled, only the new email is required to confirm.
double_confirm_changes = true
# If enabled, users need to confirm their email address before signing in.
enable_confirmations = false
# If enabled, users will need to reauthenticate or have logged in recently to change their password.
secure_password_change = false
# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
max_frequency = "1s"
# Number of characters used in the email OTP.
otp_length = 6
# Number of seconds before the email OTP expires (defaults to 1 hour).
otp_expiry = 3600
# Use a production-ready SMTP server
# [auth.email.smtp]
# enabled = true
# host = "smtp.sendgrid.net"
# port = 587
# user = "apikey"
# pass = "env(SENDGRID_API_KEY)"
# admin_email = "admin@email.com"
# sender_name = "Admin"
# Uncomment to customize email template
# [auth.email.template.invite]
# subject = "You have been invited"
# content_path = "./supabase/templates/invite.html"
[auth.sms]
# Allow/disallow new user signups via SMS to your project.
enable_signup = false
# If enabled, users need to confirm their phone number before signing in.
enable_confirmations = false
# Template for sending OTP to users
template = "Your code is {{ .Code }}"
# Controls the minimum amount of time that must pass before sending another sms otp.
max_frequency = "5s"
# Use pre-defined map of phone number to OTP for testing.
# [auth.sms.test_otp]
# 4152127777 = "123456"
# Configure logged in session timeouts.
# [auth.sessions]
# Force log out after the specified duration.
# timebox = "24h"
# Force log out if the user has been inactive longer than the specified duration.
# inactivity_timeout = "8h"
# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
# [auth.hook.custom_access_token]
# enabled = true
# uri = "pg-functions://<database>/<schema>/<hook_name>"
# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.
[auth.sms.twilio]
enabled = false
account_sid = ""
message_service_sid = ""
# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:
auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"
# Multi-factor-authentication is available to Supabase Pro plan.
[auth.mfa]
# Control how many MFA factors can be enrolled at once per user.
max_enrolled_factors = 10
# Control MFA via App Authenticator (TOTP)
[auth.mfa.totp]
enroll_enabled = false
verify_enabled = false
# Configure MFA via Phone Messaging
[auth.mfa.phone]
enroll_enabled = false
verify_enabled = false
otp_length = 6
template = "Your code is {{ .Code }}"
max_frequency = "5s"
# Configure MFA via WebAuthn
# [auth.mfa.web_authn]
# enroll_enabled = true
# verify_enabled = true
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
# `twitter`, `slack`, `spotify`, `workos`, `zoom`.
[auth.external.apple]
enabled = false
client_id = ""
# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"
# Overrides the default auth redirectUrl.
redirect_uri = ""
# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
# or any other third-party OIDC providers.
url = ""
# If enabled, the nonce check will be skipped. Required for local sign in with Google auth.
skip_nonce_check = false
# Use Firebase Auth as a third-party provider alongside Supabase Auth.
[auth.third_party.firebase]
enabled = false
# project_id = "my-firebase-project"
# Use Auth0 as a third-party provider alongside Supabase Auth.
[auth.third_party.auth0]
enabled = false
# tenant = "my-auth0-tenant"
# tenant_region = "us"
# Use AWS Cognito (Amplify) as a third-party provider alongside Supabase Auth.
[auth.third_party.aws_cognito]
enabled = false
# user_pool_id = "my-user-pool-id"
# user_pool_region = "us-east-1"
[edge_runtime]
enabled = true
# Configure one of the supported request policies: `oneshot`, `per_worker`.
# Use `oneshot` for hot reload, or `per_worker` for load testing.
policy = "oneshot"
# Port to attach the Chrome inspector for debugging edge functions.
inspector_port = 8083
# Use these configurations to customize your Edge Function.
# [functions.MY_FUNCTION_NAME]
# enabled = true
# verify_jwt = true
# import_map = "./functions/MY_FUNCTION_NAME/deno.json"
# Uncomment to specify a custom file path to the entrypoint.
# Supported file extensions are: .ts, .js, .mjs, .jsx, .tsx
# entrypoint = "./functions/MY_FUNCTION_NAME/index.ts"
# Specifies static files to be bundled with the function. Supports glob patterns.
# For example, if you want to serve static HTML pages in your function:
# static_files = [ "./functions/MY_FUNCTION_NAME/*.html" ]
[analytics]
enabled = true
port = 54327
# Configure one of the supported backends: `postgres`, `bigquery`.
backend = "postgres"
# Experimental features may be deprecated any time
[experimental]
# Configures Postgres storage engine to use OrioleDB (S3)
orioledb_version = ""
# Configures S3 bucket URL, eg. <bucket_name>.s3-<region>.amazonaws.com
s3_host = "env(S3_HOST)"
# Configures S3 bucket region, eg. us-east-1
s3_region = "env(S3_REGION)"
# Configures AWS_ACCESS_KEY_ID for S3 bucket
s3_access_key = "env(S3_ACCESS_KEY)"
# Configures AWS_SECRET_ACCESS_KEY for S3 bucket
s3_secret_key = "env(S3_SECRET_KEY)"

37
nazara/deleteme/.gitignore vendored Normal file
View File

@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# testing
coverage
# next.js
.next/
.swc/
out/
build
# expo
.expo
# misc
.DS_Store
*.pem
dist
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# turbo
.turbo

32
nazara/deleteme/README.md Normal file
View File

@ -0,0 +1,32 @@
# Turborepo react-native starter
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.
## Using this example
Run the following command:
```sh
npx create-turbo@latest -e with-react-native-web
```
## What's inside?
This Turborepo includes the following packages/apps:
### Apps and Packages
- `native`: a [react-native](https://reactnative.dev/) app built with [expo](https://docs.expo.dev/)
- `web`: a [Next.js](https://nextjs.org/) app built with [react-native-web](https://necolas.github.io/react-native-web/)
- `@repo/ui`: a stub [react-native](https://reactnative.dev/) component library shared by both `web` and `native` applications
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
### Utilities
This Turborepo has some additional tools already setup for you:
- [Expo](https://docs.expo.dev/) for native development
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [Prettier](https://prettier.io) for code formatting

View File

@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}

14
nazara/deleteme/apps/native/.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
# macOS
.DS_Store

View File

@ -0,0 +1,3 @@
# Native
A [react-native](https://reactnative.dev/) app built using [expo](https://docs.expo.dev/)

View File

@ -0,0 +1,39 @@
{
"expo": {
"name": "native",
"slug": "native",
"version": "1.0.0",
"scheme": "com.turbo.example",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.turbo.example"
},
"web": {
"favicon": "./assets/favicon.png",
"bundler": "metro"
},
"plugins": [
"expo-router"
]
}
}

View File

@ -0,0 +1,7 @@
import { Stack } from "expo-router"
const AppLayout = () => {
return <Stack />
}
export default AppLayout

View File

@ -0,0 +1,33 @@
import { StyleSheet, Text, View } from "react-native";
import { StatusBar } from "expo-status-bar";
import { Button } from "@repo/ui";
export default function Native() {
return (
<View style={styles.container}>
<Text style={styles.header}>Native</Text>
<Button
onClick={() => {
console.log("Pressed!");
alert("Pressed!");
}}
text="Boop"
/>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
header: {
fontWeight: "bold",
marginBottom: 20,
fontSize: 36,
},
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,6 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
};
};

View File

@ -0,0 +1 @@
import "expo-router/entry"

View File

@ -0,0 +1,21 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");
// Find the workspace root, this can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(__dirname, "../..");
const projectRoot = __dirname;
const config = getDefaultConfig(projectRoot);
// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot];
// 2. Let Metro know where to resolve packages, and in what order
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
];
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
config.resolver.disableHierarchicalLookup = true;
module.exports = config;

View File

@ -0,0 +1,35 @@
{
"name": "native",
"version": "1.0.0",
"private": true,
"main": "index.js",
"scripts": {
"dev": "expo start --web",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@repo/ui": "*",
"expo": "~51.0.39",
"expo-constants": "~16.0.2",
"expo-linking": "~6.3.1",
"expo-router": "~3.5.24",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.7",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.74.5",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-web": "~0.19.10"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@expo/webpack-config": "^19.0.0",
"@types/react": "~18.2.14",
"@types/react-native": "^0.73.0",
"typescript": "~5.3.3"
}
}

View File

@ -0,0 +1,6 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

34
nazara/deleteme/apps/web/.gitignore vendored Normal file
View File

@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel

View File

@ -0,0 +1,28 @@
## Getting Started
First, run the development server:
```bash
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
To create [API routes](https://nextjs.org/docs/app/building-your-application/routing/router-handlers) add an `api/` directory to the `app/` directory with a `route.ts` file. For individual endpoints, create a subfolder in the `api` directory, like `api/hello/route.ts` would map to [http://localhost:3000/api/hello](http://localhost:3000/api/hello).
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

View File

@ -0,0 +1,11 @@
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}

View File

@ -0,0 +1,14 @@
"use client";
import { Button } from "@repo/ui";
import styles from "../styles/index.module.css";
export default function Web() {
return (
<div className={styles.container}>
<h1>Web</h1>
<Button onClick={() => console.log("Pressed!")} text="Boop" />
</div>
);
}

View File

@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.

View File

@ -0,0 +1,18 @@
module.exports = {
reactStrictMode: true,
webpack: (config) => {
config.resolve.alias = {
...(config.resolve.alias || {}),
// Transform all direct `react-native` imports to `react-native-web`
"react-native$": "react-native-web",
};
config.resolve.extensions = [
".web.js",
".web.jsx",
".web.ts",
".web.tsx",
...config.resolve.extensions,
];
return config;
},
};

View File

@ -0,0 +1,28 @@
{
"name": "web",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@repo/ui": "*",
"next": "^14.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native-web": "^0.19.10"
},
"devDependencies": {
"@repo/typescript-config": "*",
"@types/node": "^20.10.6",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.18",
"babel-plugin-react-native-web": "^0.19.10",
"eslint": "^8.56.0",
"eslint-config-next": "14.0.4",
"typescript": "5.5.4"
}
}

View File

@ -0,0 +1,8 @@
body {
font-family: "SF Pro Text", "SF Pro Icons", "Helvetica Neue", "Helvetica",
"Arial", sans-serif;
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,3 @@
.container {
text-align: center;
}

View File

@ -0,0 +1,8 @@
{
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"plugins": [{ "name": "next" }]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}

View File

@ -0,0 +1,22 @@
{
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"dev": "turbo run dev",
"build": "turbo run build",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\" --ignore-path .gitignore"
},
"devDependencies": {
"prettier": "^3.1.1",
"turbo": "^2.4.0"
},
"packageManager": "yarn@1.22.19",
"engines": {
"node": ">=18"
},
"name": "with-react-native-web"
}

View File

@ -0,0 +1,19 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
},
"exclude": ["node_modules"]
}

View File

@ -0,0 +1,19 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"allowJs": true,
"declaration": false,
"declarationMap": false,
"incremental": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"noEmit": true,
"resolveJsonModule": true,
"strict": true,
"target": "es5"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}

View File

@ -0,0 +1,8 @@
{
"name": "@repo/typescript-config",
"version": "0.0.0",
"private": true,
"publishConfig": {
"access": "public"
}
}

View File

@ -0,0 +1,12 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"allowJs": true,
"jsx": "react",
"lib": ["DOM", "ESNext"],
"noEmit": true,
"resolveJsonModule": true,
"target": "ESNext"
}
}

28
nazara/deleteme/packages/ui/.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# misc
.DS_Store
*.pem
# build
dist
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# turbo
.turbo

View File

@ -0,0 +1,22 @@
{
"name": "@repo/ui",
"version": "0.0.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"clean": "rm -rf dist"
},
"devDependencies": {
"@repo/typescript-config": "*",
"@types/react": "^18.2.14",
"@types/react-native": "^0.73.0",
"tsup": "^8.0.1",
"typescript": "5.5.4"
},
"dependencies": {
"react": "^18.2.0",
"react-native": "0.74.5"
}
}

View File

@ -0,0 +1,37 @@
import * as React from "react";
import {
StyleSheet,
GestureResponderEvent,
Text,
Pressable,
} from "react-native";
export interface ButtonProps {
text: string;
onClick?: (event: GestureResponderEvent) => void;
}
export function Button({ text, onClick }: ButtonProps) {
return (
<Pressable style={styles.button} onPress={onClick}>
<Text style={styles.text}>{text}</Text>
</Pressable>
);
}
const styles = StyleSheet.create({
button: {
maxWidth: 200,
textAlign: "center",
borderRadius: 10,
paddingTop: 14,
paddingBottom: 14,
paddingLeft: 30,
paddingRight: 30,
fontSize: 15,
backgroundColor: "#2f80ed",
},
text: {
color: "white",
},
});

View File

@ -0,0 +1 @@
export { Button, type ButtonProps } from "./button";

View File

@ -0,0 +1,8 @@
{
"extends": "@repo/typescript-config/react-native-library",
"include": ["."],
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": {
"strict": true
}
}

View File

@ -0,0 +1,15 @@
import { defineConfig, Options } from "tsup";
export default defineConfig((options: Options) => ({
entry: {
index: "src/index.tsx",
},
banner: {
js: "'use client'",
},
clean: true,
format: ["cjs", "esm"],
external: ["react"],
dts: true,
...options,
}));

View File

@ -0,0 +1,19 @@
{
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"tasks": {
"build": {
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"dev": {
"cache": false,
"persistent": true
},
"lint": {},
"clean": {
"cache": false
}
}
}

11726
nazara/deleteme/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

483
nazara/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff