95-fix-home-screen-account-button-ui #124

Merged
eta357 merged 17 commits from 95-fix-home-screen-account-button-ui into main 2024-11-22 22:32:54 +00:00
Owner

Fix formatting/styling and give functionality to personal profile section, including logout, login, and signup.

Fix formatting/styling and give functionality to personal profile section, including logout, login, and signup.
ecco257 added 12 commits 2024-11-01 21:23:39 +00:00
Update formatting of profile login buttons and display
All checks were successful
Push Workflows / docs (push) Successful in 3m14s
Push Workflows / test (push) Successful in 5m29s
Push Workflows / leptos-test (push) Successful in 8m8s
Push Workflows / build (push) Successful in 8m59s
Push Workflows / docker-build (push) Successful in 16m55s
ab50826d31
Detect user logged in and display "logged in" for profile
All checks were successful
Push Workflows / docs (push) Successful in 5m57s
Push Workflows / test (push) Successful in 9m44s
Push Workflows / leptos-test (push) Successful in 12m4s
Push Workflows / build (push) Successful in 12m35s
Push Workflows / docker-build (push) Successful in 20m27s
3149f65a97
Remove derive Default for User and make user signal Option type instead
All checks were successful
Push Workflows / docs (push) Successful in 1m18s
Push Workflows / test (push) Successful in 1m33s
Push Workflows / build (push) Successful in 2m13s
Push Workflows / leptos-test (push) Successful in 6m5s
Push Workflows / docker-build (push) Successful in 16m23s
f104a14f98
Display username in profile container when logged in
All checks were successful
Push Workflows / docs (push) Successful in 5m31s
Push Workflows / test (push) Successful in 8m42s
Push Workflows / leptos-test (push) Successful in 12m48s
Push Workflows / build (push) Successful in 15m21s
Push Workflows / docker-build (push) Successful in 34m40s
2d7b91413b
Fix formatting and styling of profile picture display, as well as display email when logged in as well
Some checks failed
Push Workflows / leptos-test (push) Successful in 2m15s
Push Workflows / docs (push) Successful in 2m21s
Push Workflows / build (push) Successful in 4m58s
Push Workflows / test (push) Successful in 3m38s
Push Workflows / docker-build (push) Failing after 4m23s
acf15961cd
Refactor profile picture display to account for no profile picture
All checks were successful
Push Workflows / leptos-test (push) Successful in 2m57s
Push Workflows / docs (push) Successful in 5m36s
Push Workflows / build (push) Successful in 2m50s
Push Workflows / test (push) Successful in 8m56s
Push Workflows / docker-build (push) Successful in 9m8s
6aa933be09
Remove email display on personal and rescale icon/pfp to be bigger & consistent
All checks were successful
Push Workflows / docs (push) Successful in 1m11s
Push Workflows / test (push) Successful in 1m38s
Push Workflows / build (push) Successful in 2m11s
Push Workflows / leptos-test (push) Successful in 4m34s
Push Workflows / docker-build (push) Successful in 12m15s
f1affc66bc
LibreTunes-Bot added the
frontend
status
in review
labels 2024-11-01 21:23:42 +00:00
ecco257 was assigned by LibreTunes-Bot 2024-11-01 21:23:42 +00:00
Member

This PR resolves #95.

This PR resolves #95.
eta357 requested changes 2024-11-02 03:24:50 +00:00
eta357 left a comment
Owner

See comment about the duplicate requests. I'm also debating changing how get_user() works (for the profile page work I'm doing) to return an Result<Option<User>, ...> instead of a Result<User, ...>, because there is a strong distinction between not having a user logged in, and a server error occurring when checking if a user is logged in.

There's also a few things that maybe should be changed with handling errors/options here (with Show, etc.). We can discuss these some other time.

I'll have to think about this.

See comment about the duplicate requests. I'm also debating changing how `get_user()` works (for the profile page work I'm doing) to return an `Result<Option<User>, ...>` instead of a `Result<User, ...>`, because there is a strong distinction between not having a user logged in, and a server error occurring when checking if a user is logged in. There's also a few things that maybe should be changed with handling errors/options here (with `Show`, etc.). We can discuss these some other time. I'll have to think about this.
@ -16,1 +18,4 @@
let (dropdown_open, set_dropdown_open) = create_signal(false);
let (image_error, set_image_error) = create_signal(false);
let user = create_local_resource(move || dropdown_open.get(), |_| async move { get_user().await });
let logged_in = create_local_resource(move || dropdown_open.get(), |_| async move { get_user().await.is_ok() });
Owner

Here you're making two separate calls to get_user, each of which causes an API request. In the interest of performance, it would be best to do this as a single query.

Here you're making two separate calls to get_user, each of which causes an API request. In the interest of performance, it would be best to do this as a single query.
eta357 marked this conversation as resolved
eta357 reviewed 2024-11-03 18:06:56 +00:00
src/auth.rs Outdated
@ -138,3 +139,3 @@
/// }
/// ```
#[cfg(feature = "ssr")]
#[server(endpoint = "get_user")]
Owner

Turning this into an API endpoint is actually dangerous, as the returned user contains the password hash. This field should be set to None before returning. Although technically the user is only returned if that user has already logged in (and therefore should already know the password), this is still not a good practice. I know I advised you to use this function, but we should add this protection. However this code may change anyways, see my other comment about potentially adding a new function returning an Option<User>.

Turning this into an API endpoint is actually dangerous, as the returned user contains the password hash. This field should be set to `None` before returning. Although technically the user is only returned if that user has already logged in (and therefore _should_ already know the password), this is still not a good practice. I know I advised you to use this function, but we should add this protection. However this code may change anyways, see my other comment about potentially adding a new function returning an `Option<User>`.
Owner

I think you were right originally about having a global logged in user object on the frontend. I can help with the development of this. Adding this would make writing several other pages easier and likely improve performance. This includes the profile page, and any other user-specific pages.

I think you were right originally about having a global logged in user object on the frontend. I can help with the development of this. Adding this would make writing several other pages easier and likely improve performance. This includes the profile page, and any other user-specific pages.
ecco257 added 1 commit 2024-11-12 22:11:20 +00:00
Reduce calls to get_user by not having logged_in resource
Some checks failed
Push Workflows / docs (push) Successful in 4m38s
Push Workflows / test (push) Successful in 6m43s
Push Workflows / leptos-test (push) Successful in 9m17s
Push Workflows / build (push) Successful in 10m25s
Push Workflows / docker-build (push) Failing after 16m44s
d8fab0e068
ecco257 added 1 commit 2024-11-17 22:38:46 +00:00
Merge remote-tracking branch 'origin/main' into 95-fix-home-screen-account-button-ui
Some checks failed
Push Workflows / docker-build (push) Failing after 1s
Push Workflows / leptos-test (push) Failing after 1s
Push Workflows / docs (push) Successful in 1m54s
Push Workflows / test (push) Successful in 3m15s
Push Workflows / build (push) Successful in 4m39s
3d1dc94b06
ecco257 added 1 commit 2024-11-17 23:43:03 +00:00
Use global state user instead of local resource in personal page
All checks were successful
Push Workflows / leptos-test (push) Successful in 4m58s
Push Workflows / docker-build (push) Successful in 12m32s
Push Workflows / docs (push) Successful in 1m29s
Push Workflows / test (push) Successful in 2m24s
Push Workflows / build (push) Successful in 3m56s
73b4b7674e
ecco257 added 1 commit 2024-11-19 21:21:43 +00:00
Revert get_user to not be server function
All checks were successful
Push Workflows / docs (push) Successful in 1m19s
Push Workflows / test (push) Successful in 2m48s
Push Workflows / build (push) Successful in 4m1s
Push Workflows / leptos-test (push) Successful in 5m3s
Push Workflows / docker-build (push) Successful in 14m58s
b25cb4549c
ecco257 added 1 commit 2024-11-22 21:32:03 +00:00
change unwrap or default to unwrap or false for readability
All checks were successful
Push Workflows / docs (push) Successful in 1m58s
Push Workflows / test (push) Successful in 3m33s
Push Workflows / leptos-test (push) Successful in 3m45s
Push Workflows / build (push) Successful in 6m47s
Push Workflows / docker-build (push) Successful in 9m16s
fcd987d433
Author
Owner

please merge, thanks team

please merge, thanks team
eta357 merged commit 9b48fc0204 into main 2024-11-22 22:32:54 +00:00
Sign in to join this conversation.
No description provided.