@@ -51,6 +59,14 @@
{space.building_location}
+
+
diff --git a/supabase/migrations/20250609142130_add-compulsory-tags.sql b/supabase/migrations/20250609142130_add-compulsory-tags.sql
index 5355520..485144c 100644
--- a/supabase/migrations/20250609142130_add-compulsory-tags.sql
+++ b/supabase/migrations/20250609142130_add-compulsory-tags.sql
@@ -2,9 +2,9 @@ alter table "public"."study_spaces" add column "power" text;
alter table "public"."study_spaces" add column "volume" text;
alter table "public"."study_spaces" add column "wifi" text;
-update "public"."study_spaces" set "power" = 'Many' where "power" is null;
+update "public"."study_spaces" set "power" = 'Many Outlets' where "power" is null;
update "public"."study_spaces" set "volume" = 'Quiet' where "volume" is null;
-update "public"."study_spaces" set "wifi" = 'Good' where "wifi" is null;
+update "public"."study_spaces" set "wifi" = 'Good WiFi' where "wifi" is null;
alter table "public"."study_spaces" alter column "power" set not null;
alter table "public"."study_spaces" alter column "volume" set not null;
diff --git a/supabase/migrations/20250610163930_add_report_table.sql b/supabase/migrations/20250610163930_add_report_table.sql
new file mode 100644
index 0000000..0ac16d0
--- /dev/null
+++ b/supabase/migrations/20250610163930_add_report_table.sql
@@ -0,0 +1,12 @@
+CREATE TABLE reports (
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
+ study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE,
+ created_at timestamp with time zone DEFAULT now(),
+ updated_at timestamp with time zone DEFAULT now(),
+ type text NOT NULL,
+ content text
+);
+
+CREATE TRIGGER reports_updated_at
+AFTER UPDATE ON reports
+FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
diff --git a/supabase/schemas/0001_study_spaces.sql b/supabase/schemas/0001_study_spaces.sql
index 9d97101..5269ceb 100644
--- a/supabase/schemas/0001_study_spaces.sql
+++ b/supabase/schemas/0001_study_spaces.sql
@@ -28,6 +28,14 @@ CREATE TABLE study_space_images (
PRIMARY KEY (study_space_id, image_path)
);
+CREATE TABLE reports (
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
+ study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE,
+ created_at timestamp with time zone DEFAULT now(),
+ updated_at timestamp with time zone DEFAULT now(),
+ type text NOT NULL,
+ content text
+);
-- Triggers
CREATE TRIGGER study_spaces_updated_at
@@ -37,3 +45,7 @@ FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
CREATE TRIGGER study_space_images_updated_at
AFTER UPDATE ON study_space_images
FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
+
+CREATE TRIGGER reports_updated_at
+AFTER UPDATE ON reports
+FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
From 4d8cffc72605c4c4c88aef366cf900d6a785b725 Mon Sep 17 00:00:00 2001
From: Barf-Vader <47476490+Barf-Vader@users.noreply.github.com>
Date: Tue, 10 Jun 2025 18:30:09 +0100
Subject: [PATCH 2/9] fix: cant submit report while uploading
---
src/lib/components/Report.svelte | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lib/components/Report.svelte b/src/lib/components/Report.svelte
index 38e3ced..a2cf295 100644
--- a/src/lib/components/Report.svelte
+++ b/src/lib/components/Report.svelte
@@ -15,7 +15,7 @@
});
async function uploadReport() {
- const { data: studySpaceInsert, error: reportUploadError } = await supabase
+ const { error: reportUploadError } = await supabase
.from("reports")
.insert(reportData)
.select()
@@ -53,8 +53,9 @@
rows={2}
bind:value={reportData.content}
/>
-
Submit
Date: Tue, 10 Jun 2025 23:44:21 +0100
Subject: [PATCH 3/9] feat: setup posthog for metrics (might or might not be
useful)
---
package-lock.json | 60 ++++++++++++++++++++++++++++++++++++++-
package.json | 3 +-
src/routes/+layout.svelte | 9 ++++++
3 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index a224f91..cf3c27b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,8 @@
"version": "0.0.1",
"dependencies": {
"@supabase/ssr": "^0.6.1",
- "@supabase/supabase-js": "^2.49.8"
+ "@supabase/supabase-js": "^2.49.8",
+ "posthog-js": "^1.250.1"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
@@ -2451,6 +2452,17 @@
"node": ">= 0.6"
}
},
+ "node_modules/core-js": {
+ "version": "3.43.0",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.43.0.tgz",
+ "integrity": "sha512-N6wEbTTZSYOY2rYAn85CuvWWkCK6QweMn7/4Nr3w+gDBeBhk/x4EJeY6FPo4QzDoJZxVTv8U7CMvgWk6pOHHqA==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/core-js"
+ }
+ },
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -3030,6 +3042,12 @@
"node": "^12.20 || >= 14.13"
}
},
+ "node_modules/fflate": {
+ "version": "0.4.8",
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz",
+ "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==",
+ "license": "MIT"
+ },
"node_modules/file-entry-cache": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
@@ -4090,6 +4108,40 @@
"node": ">=4"
}
},
+ "node_modules/posthog-js": {
+ "version": "1.250.1",
+ "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.250.1.tgz",
+ "integrity": "sha512-Dl9BQjPa5FFVUauLSX/8HP6naRfU605GQYq+oAHFqwyv20NQDCHT0uRtFT1x2EYrY0kIQdd0d/rOY6Tg4wgqEg==",
+ "license": "SEE LICENSE IN LICENSE",
+ "dependencies": {
+ "core-js": "^3.38.1",
+ "fflate": "^0.4.8",
+ "preact": "^10.19.3",
+ "web-vitals": "^4.2.4"
+ },
+ "peerDependencies": {
+ "@rrweb/types": "2.0.0-alpha.17",
+ "rrweb-snapshot": "2.0.0-alpha.17"
+ },
+ "peerDependenciesMeta": {
+ "@rrweb/types": {
+ "optional": true
+ },
+ "rrweb-snapshot": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/preact": {
+ "version": "10.26.8",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.26.8.tgz",
+ "integrity": "sha512-1nMfdFjucm5hKvq0IClqZwK4FJkGXhRrQstOQ3P4vp8HxKrJEMFcY6RdBRVTdfQS/UlnX6gfbPuTvaqx/bDoeQ==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/preact"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -5117,6 +5169,12 @@
"node": ">= 8"
}
},
+ "node_modules/web-vitals": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.4.tgz",
+ "integrity": "sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==",
+ "license": "Apache-2.0"
+ },
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
diff --git a/package.json b/package.json
index 74b26fa..bff1980 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
},
"dependencies": {
"@supabase/ssr": "^0.6.1",
- "@supabase/supabase-js": "^2.49.8"
+ "@supabase/supabase-js": "^2.49.8",
+ "posthog-js": "^1.250.1"
}
}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index dee0137..289e977 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,7 +1,16 @@
From bdda39c7fe68c5cabcf2d3abd2a20271d9280dec Mon Sep 17 00:00:00 2001
From: Barf-Vader <47476490+Barf-Vader@users.noreply.github.com>
Date: Wed, 11 Jun 2025 00:03:29 +0100
Subject: [PATCH 4/9] refactor: added typing for props, fixed overflow
---
src/lib/components/CompulsoryTags.svelte | 6 +++---
src/lib/components/Report.svelte | 10 +++++++++-
src/lib/components/SpaceCard.svelte | 4 ++--
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/lib/components/CompulsoryTags.svelte b/src/lib/components/CompulsoryTags.svelte
index e6a1228..ba5a23b 100644
--- a/src/lib/components/CompulsoryTags.svelte
+++ b/src/lib/components/CompulsoryTags.svelte
@@ -33,7 +33,7 @@
background-color: #eaffeb;
color: #2e4653;
cursor: pointer;
- padding: 0.2rem 0.6rem;
+ padding: 0.2rem 0.2rem;
}
.compulsoryTagYellow {
display: flex;
@@ -45,7 +45,7 @@
background-color: #ffffd4;
color: #534b2e;
cursor: pointer;
- padding: 0.2rem 0.6rem;
+ padding: 0.2rem 0.2rem;
}
.compulsoryTagRed {
display: flex;
@@ -57,6 +57,6 @@
background-color: #ffcece;
color: #532e2e;
cursor: pointer;
- padding: 0.2rem 0.6rem;
+ padding: 0.2rem 0.2rem;
}
diff --git a/src/lib/components/Report.svelte b/src/lib/components/Report.svelte
index a2cf295..ff2b498 100644
--- a/src/lib/components/Report.svelte
+++ b/src/lib/components/Report.svelte
@@ -3,8 +3,16 @@
import crossUrl from "$lib/assets/cross.svg";
import Textarea from "./inputs/Textarea.svelte";
import type { Table } from "$lib";
+ import type { SupabaseClient } from "@supabase/supabase-js";
+ import type { Database } from "$lib/database.d.ts";
- const { data, studySpaceId, hideFunc } = $props();
+ interface Props {
+ data: { supabase: SupabaseClient };
+ studySpaceId: string;
+ hideFunc: () => void;
+ }
+
+ const { data, studySpaceId, hideFunc }: Props = $props();
const { supabase } = $derived(data);
let uploading = $state(false);
diff --git a/src/lib/components/SpaceCard.svelte b/src/lib/components/SpaceCard.svelte
index e845299..3f09963 100644
--- a/src/lib/components/SpaceCard.svelte
+++ b/src/lib/components/SpaceCard.svelte
@@ -78,7 +78,7 @@
.compulsoryContainer {
display: grid;
grid-template-columns: repeat(3, 1fr);
- gap: 0.5rem;
- font-size: 0.875rem;
+ gap: 0.4rem;
+ font-size: 0.8rem;
}
From bd7f9bc9912367b4cb3ffdab50d6b671a8417a55 Mon Sep 17 00:00:00 2001
From: Gleb Koval
Date: Tue, 10 Jun 2025 19:00:22 +0100
Subject: [PATCH 5/9] feat: google maps
---
.env.example | 3 +-
package-lock.json | 23 ++++++++++
package.json | 3 ++
src/lib/components/inputs/Text.svelte | 5 ++-
src/lib/database.d.ts | 9 ++--
src/lib/index.ts | 10 +++++
src/routes/space/+page.svelte | 42 ++++++++++++++++---
src/routes/space/[id]/+page.svelte | 35 +++++++++++++++-
.../20250609145614_gmaps_location.sql | 3 ++
supabase/schemas/0001_study_spaces.sql | 4 +-
10 files changed, 123 insertions(+), 14 deletions(-)
create mode 100644 supabase/migrations/20250609145614_gmaps_location.sql
diff --git a/.env.example b/.env.example
index d84d274..efae49e 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,3 @@
PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
-PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here
\ No newline at end of file
+PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here
+PUBLIC_GMAPS_API_KEY=your-google-maps-api-key-here
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index cf3c27b..6da5e80 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,7 @@
"name": "drp-48",
"version": "0.0.1",
"dependencies": {
+ "@googlemaps/js-api-loader": "^1.16.8",
"@supabase/ssr": "^0.6.1",
"@supabase/supabase-js": "^2.49.8",
"posthog-js": "^1.250.1"
@@ -15,12 +16,14 @@
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
+ "@googlemaps/typescript-guards": "^2.0.3",
"@playwright/test": "^1.49.1",
"@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/kit": "^2.16.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/svelte": "^5.2.4",
+ "@types/google.maps": "^3.58.1",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.0.0",
@@ -819,6 +822,19 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
+ "node_modules/@googlemaps/js-api-loader": {
+ "version": "1.16.8",
+ "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.16.8.tgz",
+ "integrity": "sha512-CROqqwfKotdO6EBjZO/gQGVTbeDps5V7Mt9+8+5Q+jTg5CRMi3Ii/L9PmV3USROrt2uWxtGzJHORmByxyo9pSQ==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@googlemaps/typescript-guards": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/@googlemaps/typescript-guards/-/typescript-guards-2.0.3.tgz",
+ "integrity": "sha512-3iHuO8H0jPehftsMK0kgyJzPYU/g/oiTRw+wu/yltqSZ7wJPt3vfsJHkPiuRpQjbnnWygX+T3mkRGyK/eyZ/lw==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@@ -1725,6 +1741,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/google.maps": {
+ "version": "3.58.1",
+ "resolved": "https://registry.npmjs.org/@types/google.maps/-/google.maps-3.58.1.tgz",
+ "integrity": "sha512-X9QTSvGJ0nCfMzYOnaVs/k6/4L+7F5uCS+4iUmkLEls6J9S/Phv+m/i3mDeyc49ZBgwab3EFO1HEoBY7k98EGQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
diff --git a/package.json b/package.json
index bff1980..3513623 100644
--- a/package.json
+++ b/package.json
@@ -20,12 +20,14 @@
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
+ "@googlemaps/typescript-guards": "^2.0.3",
"@playwright/test": "^1.49.1",
"@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/kit": "^2.16.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/svelte": "^5.2.4",
+ "@types/google.maps": "^3.58.1",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.0.0",
@@ -42,6 +44,7 @@
"vitest": "^3.0.0"
},
"dependencies": {
+ "@googlemaps/js-api-loader": "^1.16.8",
"@supabase/ssr": "^0.6.1",
"@supabase/supabase-js": "^2.49.8",
"posthog-js": "^1.250.1"
diff --git a/src/lib/components/inputs/Text.svelte b/src/lib/components/inputs/Text.svelte
index 8488479..cb9b9bc 100644
--- a/src/lib/components/inputs/Text.svelte
+++ b/src/lib/components/inputs/Text.svelte
@@ -1,15 +1,16 @@
-
+
From be921610f6e809e81ad69efa0cff0d98ae9cd60a Mon Sep 17 00:00:00 2001
From: Barf-Vader <47476490+Barf-Vader@users.noreply.github.com>
Date: Wed, 11 Jun 2025 01:06:39 +0100
Subject: [PATCH 9/9] fix: overflow in report and space page
---
src/lib/components/Report.svelte | 5 ++++-
src/routes/space/[id]/+page.svelte | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lib/components/Report.svelte b/src/lib/components/Report.svelte
index ff2b498..6322b9b 100644
--- a/src/lib/components/Report.svelte
+++ b/src/lib/components/Report.svelte
@@ -46,7 +46,7 @@
}}
class="reportContainer"
>
- Submit a Report
+
What's the reason?