From 435ebc04e8e01476bd77c1e34fb7066985de949b Mon Sep 17 00:00:00 2001
From: John Lewis
Date: Fri, 16 Feb 2024 21:47:20 -0600
Subject: [PATCH 01/22] credit dad for his "photo deck" idea
---
accreditations.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 accreditations.md
diff --git a/accreditations.md b/accreditations.md
new file mode 100644
index 0000000..657878d
--- /dev/null
+++ b/accreditations.md
@@ -0,0 +1 @@
+- **Blanton Lewis** - for thoughtful design recommendations.
From 8145f46a363d83605f7acc9c4eec1dd701914764 Mon Sep 17 00:00:00 2001
From: John Lewis
Date: Fri, 16 Feb 2024 21:48:10 -0600
Subject: [PATCH 02/22] make a super basic gallery mockup
---
crates/site-app/src/components/gallery.rs | 65 ++++++++++++++++++++---
1 file changed, 57 insertions(+), 8 deletions(-)
diff --git a/crates/site-app/src/components/gallery.rs b/crates/site-app/src/components/gallery.rs
index 078980b..d39b9b5 100644
--- a/crates/site-app/src/components/gallery.rs
+++ b/crates/site-app/src/components/gallery.rs
@@ -15,19 +15,68 @@ pub fn Gallery() -> impl IntoView {
);
view! {
- "Loading..."
}>
- { move || photo_groups.map(|groups| view! {
-
-
- {format!("Photo Groups: {:#?}", groups)}
-
-
- })}
+
+ { move || photo_groups.map(|groups| {
+ match groups {
+ Ok(groups) => {
+ view! {
+
+ }
+ .into_view()
+ }
+ Err(e) => {
+ view! {
+ "Failed to load photo groups: {e}"
+ }
+ .into_view()
+ }
+ }
+ }) }
}
.into_view()
}
+#[component]
+fn PhotoGroupList(groups: Vec) -> impl IntoView {
+ view! {
+
+ { groups.into_iter().map(|group| {
+ view! {
+
+ }
+ .into_view()
+ }).collect::
>() }
+
+ }
+ .into_view()
+}
+
+#[component]
+fn PhotoGroup(group: core_types::PhotoGroup) -> impl IntoView {
+ view! {
+
+
+ { group.photos.into_iter().map(|photo_id| {
+ view! {
+
+ }
+ .into_view()
+ }).collect::
>() }
+
+
+ }
+}
+
+#[component]
+fn Photo(photo_id: core_types::PhotoRecordId) -> impl IntoView {
+ view! {
+
+
{ format!("{photo_id:?}") }
+
+ }
+}
+
#[server]
pub async fn get_user_photo_groups(
user_id: core_types::UserRecordId,
From 3ce3df6639821ecf25667596350fefa9ce1f2e03 Mon Sep 17 00:00:00 2001
From: John Lewis
Date: Fri, 16 Feb 2024 21:48:43 -0600
Subject: [PATCH 03/22] add container queries to tailwind
---
crates/site-app/style/tailwind/package.json | 1 +
crates/site-app/style/tailwind/yarn.lock | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/crates/site-app/style/tailwind/package.json b/crates/site-app/style/tailwind/package.json
index f67a454..ea5640d 100644
--- a/crates/site-app/style/tailwind/package.json
+++ b/crates/site-app/style/tailwind/package.json
@@ -3,6 +3,7 @@
"version": "1.0.0",
"main": "tailwind.config.js",
"dependencies": {
+ "@tailwindcss/container-queries": "^0.1.1",
"daisyui": "^4.6.2",
"postcss": "^8.4.35"
}
diff --git a/crates/site-app/style/tailwind/yarn.lock b/crates/site-app/style/tailwind/yarn.lock
index 0e32a79..b32924c 100644
--- a/crates/site-app/style/tailwind/yarn.lock
+++ b/crates/site-app/style/tailwind/yarn.lock
@@ -2,6 +2,11 @@
# yarn lockfile v1
+"@tailwindcss/container-queries@^0.1.1":
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/@tailwindcss/container-queries/-/container-queries-0.1.1.tgz#9a759ce2cb8736a4c6a0cb93aeb740573a731974"
+ integrity sha512-p18dswChx6WnTSaJCSGx6lTmrGzNNvm2FtXmiO6AuA1V4U5REyoqwmT6kgAsIMdjo07QdAfYXHJ4hnMtfHzWgA==
+
camelcase-css@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5"
From 844dc635c967965bed39f0326660ea418213c580 Mon Sep 17 00:00:00 2001
From: John Lewis
Date: Fri, 16 Feb 2024 21:52:43 -0600
Subject: [PATCH 04/22] update yarn hash in flake
---
flake.nix | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flake.nix b/flake.nix
index 15ea5d3..031c6f5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -87,7 +87,7 @@
# an offline yarn registry for the tailwind packages
style-js-packages-yarn-registry = pkgs.fetchYarnDeps {
yarnLock = ./crates/site-app/style/tailwind/yarn.lock;
- hash = "sha256-nqOJBcjX+dFl/XkBH+HfRO6Ce+CErm3YkQjG1W+aUPw=";
+ hash = "sha256-uYcqauHqsk58oWtA2uUYsJ2OuW8o2Rh6KrW88fK9UfE=";
# hash = "";
};
From add111cd38075ea25c40ec458fd58930969c82d9 Mon Sep 17 00:00:00 2001
From: John Lewis
Date: Sat, 17 Feb 2024 13:07:17 -0600
Subject: [PATCH 05/22] feat: impl Copy on `core_types` record IDs
---
crates/core_types/src/artifact.rs | 4 ++--
crates/core_types/src/auth.rs | 2 +-
crates/core_types/src/photo.rs | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/crates/core_types/src/artifact.rs b/crates/core_types/src/artifact.rs
index 397468b..3824d0d 100644
--- a/crates/core_types/src/artifact.rs
+++ b/crates/core_types/src/artifact.rs
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
pub const PRIVATE_ARTIFACT_TABLE: &str = "private_artifact";
pub const PUBLIC_ARTIFACT_TABLE: &str = "public_artifact";
-#[derive(Clone, Debug, Deserialize, Serialize)]
+#[derive(Clone, Debug, Deserialize, Serialize, Copy)]
#[cfg_attr(feature = "ssr", serde(from = "crate::conv::UlidOrThing"))]
pub struct PrivateArtifactRecordId(pub ulid::Ulid);
@@ -14,7 +14,7 @@ pub struct PrivateArtifact {
pub contents: Option,
}
-#[derive(Clone, Debug, Deserialize, Serialize)]
+#[derive(Clone, Debug, Deserialize, Serialize, Copy)]
#[cfg_attr(feature = "ssr", serde(from = "crate::conv::UlidOrThing"))]
pub struct PublicArtifactRecordId(pub ulid::Ulid);
diff --git a/crates/core_types/src/auth.rs b/crates/core_types/src/auth.rs
index 8c55e9f..ee73cc0 100644
--- a/crates/core_types/src/auth.rs
+++ b/crates/core_types/src/auth.rs
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
pub const USER_TABLE: &str = "user";
-#[derive(Serialize, Deserialize, Debug, Clone)]
+#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
#[cfg_attr(feature = "ssr", serde(from = "crate::conv::UlidOrThing"))]
pub struct UserRecordId(pub ulid::Ulid);
diff --git a/crates/core_types/src/photo.rs b/crates/core_types/src/photo.rs
index 18f6dad..5278e8c 100644
--- a/crates/core_types/src/photo.rs
+++ b/crates/core_types/src/photo.rs
@@ -8,7 +8,7 @@ use crate::{
auth::UserRecordId,
};
-#[derive(Clone, Debug, Deserialize, Serialize)]
+#[derive(Clone, Debug, Deserialize, Serialize, Copy)]
#[cfg_attr(feature = "ssr", serde(from = "crate::conv::UlidOrThing"))]
pub struct PhotoRecordId(pub ulid::Ulid);
@@ -26,7 +26,7 @@ pub struct PhotoArtifacts {
pub thumbnail: PublicArtifact,
}
-#[derive(Clone, Debug, Deserialize, Serialize)]
+#[derive(Clone, Debug, Deserialize, Serialize, Copy)]
#[cfg_attr(feature = "ssr", serde(from = "crate::conv::UlidOrThing"))]
pub struct PhotoGroupRecordId(pub ulid::Ulid);
From 427e2e58e6ca5b6a1a73230e1c5bb80d0a731bf9 Mon Sep 17 00:00:00 2001
From: John Lewis
Date: Sat, 17 Feb 2024 13:07:53 -0600
Subject: [PATCH 06/22] feat: impl IntoResource on `core_types` IDs
---
crates/core_types/src/conv.rs | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/crates/core_types/src/conv.rs b/crates/core_types/src/conv.rs
index cf6ff86..38b0e18 100644
--- a/crates/core_types/src/conv.rs
+++ b/crates/core_types/src/conv.rs
@@ -1,6 +1,9 @@
use serde::Deserialize;
use surreal_id::NewId;
-use surrealdb::sql::{Id, Thing};
+use surrealdb::{
+ opt::{IntoResource, Resource},
+ sql::{Id, Thing},
+};
use crate::{
PhotoGroupRecordId, PhotoRecordId, PrivateArtifactRecordId,
@@ -64,3 +67,19 @@ impl AsThing for T {
}
}
}
+
+macro_rules! impl_into_resource {
+ ($type:ty) => {
+ impl IntoResource