WIP PWA for Grain
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: bottom nav user icon navigates to logged-in user profile

+19 -4
+19 -4
src/components/organisms/grain-bottom-nav.js
··· 1 1 import { LitElement, html, css } from 'lit'; 2 2 import { router } from '../../router.js'; 3 + import { auth } from '../../services/auth.js'; 3 4 import '../atoms/grain-icon.js'; 4 5 5 6 export class GrainBottomNav extends LitElement { 6 7 static properties = { 7 - active: { type: String } 8 + active: { type: String }, 9 + _user: { state: true } 8 10 }; 9 11 10 12 static styles = css` ··· 45 47 constructor() { 46 48 super(); 47 49 this.active = 'home'; 50 + this._user = auth.user; 51 + } 52 + 53 + connectedCallback() { 54 + super.connectedCallback(); 55 + this._unsubscribe = auth.subscribe(user => { 56 + this._user = user; 57 + }); 58 + } 59 + 60 + disconnectedCallback() { 61 + super.disconnectedCallback(); 62 + this._unsubscribe?.(); 48 63 } 49 64 50 65 #handleHome() { ··· 52 67 } 53 68 54 69 #handleProfile() { 55 - // For now, just go to a sample profile 56 - // Later this would go to the logged-in user's profile 57 - router.push('/'); 70 + if (this._user?.handle) { 71 + router.push(`/profile/${this._user.handle}`); 72 + } 58 73 } 59 74 60 75 render() {