-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28966d7
commit 26a5e69
Showing
9 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::store::Store; | ||
use stylist::Style; | ||
use yew::{function_component, html, Html}; | ||
use yewdux::prelude::*; | ||
|
||
const STYLE: &str = include_str!("styles/footer.css"); | ||
|
||
#[function_component(Footer)] | ||
pub fn footer() -> Html { | ||
let style = Style::new(STYLE).unwrap(); | ||
let store = use_store_value::<Store>(); | ||
|
||
html! { | ||
<div class={style}> | ||
<div class="footer"> | ||
// <DeleteAccount /> | ||
// {loggedIn && | ||
<span>{"Welcome "}{store.username.clone()}</span> | ||
// } | ||
</div> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod comment; | ||
pub mod footer; | ||
pub mod items; | ||
pub mod navbar; | ||
pub mod pager; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.footer { | ||
height: 50; | ||
width: 100vw; | ||
bottom: 0; | ||
left: 0; | ||
position: fixed; | ||
z-index: 10; | ||
display: flex; | ||
} | ||
|
||
.footer button, | ||
.footer>span { | ||
padding: 5px; | ||
margin: 10px; | ||
} | ||
|
||
.footer button { | ||
height: fit-content; | ||
} | ||
|
||
.footer>span { | ||
margin-left: auto; | ||
margin-right: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,55 @@ | ||
use gloo_net::http::{Headers, Method}; | ||
use stylist::Style; | ||
use yew::prelude::*; | ||
use yewdux::use_store_value; | ||
|
||
use crate::{ | ||
helpers::{self, CustomCallback}, | ||
store::Store, | ||
Api, User, | ||
}; | ||
|
||
const STYLE: &str = include_str!("styles/account.css"); | ||
|
||
#[function_component(Account)] | ||
pub fn account() -> Html { | ||
let style = Style::new(STYLE).unwrap(); | ||
let user = use_state(User::default); | ||
let user_cb = CustomCallback::new(&user); | ||
let store = use_store_value::<Store>(); | ||
|
||
// get current user | ||
use_effect_with((), |_| { | ||
wasm_bindgen_futures::spawn_local(async move { | ||
let hdrs = Headers::new(); | ||
let auth = format!("Bearer {}", store.token.clone()); | ||
hdrs.append("Authorization", &auth); | ||
|
||
let res = Api::GetCurrentUser | ||
.fetch(Some(hdrs), None, Method::GET) | ||
.await; | ||
|
||
helpers::emit(&user_cb, res.unwrap()).await; | ||
}) | ||
}); | ||
|
||
html! { | ||
<section> | ||
<h1>{"Account Page"}</h1> | ||
<section class={style}> | ||
<div class="account"> | ||
<div> | ||
<h1>{"Account Details"}</h1> | ||
<p>{"Username: "}{&user.username}</p> | ||
<p>{"Email: "}{&user.email}</p> | ||
</div> | ||
<div> | ||
<h1>{"Email Preferences"}</h1> | ||
<input type="checkbox" | ||
checked={user.subscribed} | ||
// onClick={handleSubscribeChange} | ||
/> | ||
<span>{"Subscribed"}</span> | ||
</div> | ||
</div> | ||
</section> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.account { | ||
font-family: 'Chivo Mono', monospace; | ||
font-size: 16px; | ||
margin-top: 100px; | ||
|
||
} | ||
|
||
.account>div>h1 { | ||
border-bottom: 1px solid grey; | ||
} |