People app and navigation + fixes
Index.js
- Fixed issue where incorrect pathname was set while not part of an organization.
- onNavigate(), fetchAppData(), getDefaultNetworkName(), and getDefaultAppName() all modified to account for user not being part of an organization (default path set to /my/dashboard)
- onNavigate() modified to properly set defaults for currentNetwork and currentApp, and modified to fix issue where app would crash when attempting to access nonexistent 'this.currentNetwork.data'
- onNavigate() now correctly switches currentApp
Home.js
- Changed ZStack to a VStack
- Replaced Jobs switch case with People
- Adjusted styling for AppMenu() and VStack height values
- Changed .onNavigate() from function() to () => {} for correct this binding
- !!!(TEMP FIX)!!!: Added extra rerender() call in an .onClick() after .onNavigate()
AppMenu()
- Modified app icons to be highlighted when active
- Changed Forum's app icon to redirect from "/" to "/dashboard"
- Removed fixed styling to account for Home's new responsive VStack layout
People.js
- Added People.js
Messages.js
- Fixed missing 'global." before Socket.send
- Changed 'vh' height values to 'pct' to account for AppMenu() at bottom
- Fixed misnamed modifiers
Forum.js
- Adjusted styling
- Changed 'vh' height values to 'pct' to account for AppMenu() at bottom
styles.css
- Added missing custom color vars
This commit is contained in:
12
src/index.js
12
src/index.js
@@ -21,6 +21,7 @@ let Global = class {
|
||||
|
||||
async fetchAppData() {
|
||||
let personalSpace = this.currentNetwork === this.profile
|
||||
if (personalSpace) { return {} }
|
||||
let appData = await fetch(`/api/${personalSpace ? "my" : "org"}data/` + this.currentNetwork.id, {method: "GET"})
|
||||
let json = await appData.json()
|
||||
return json
|
||||
@@ -32,9 +33,12 @@ let Global = class {
|
||||
let selectedApp = this.appFromPath()
|
||||
|
||||
if(!selectedNetwork) {
|
||||
if(this.profile.networks.length > 0) {
|
||||
if (!this.currentNetwork || this.currentNetwork === this.profile) {
|
||||
let path = `/${this.getDefaultNetworkName()}/${this.getDefaultAppName()}`
|
||||
history.replaceState({}, '', path)
|
||||
} else {
|
||||
let path = `/${this.currentNetwork.abbreviation}${window.location.pathname}`
|
||||
history.replaceState({}, '', path)
|
||||
}
|
||||
} else if(!selectedApp) {
|
||||
if(this.currentNetwork === window.profile) {
|
||||
@@ -50,6 +54,7 @@ let Global = class {
|
||||
let networkChanged = this.currentNetwork !== selectedNetwork
|
||||
let appChanged = this.currentApp !== selectedApp
|
||||
if(networkChanged) {
|
||||
console.log("onNavigate: network changed ->", selectedNetwork?.abbreviation)
|
||||
this.currentNetwork = selectedNetwork
|
||||
this.currentApp = selectedApp
|
||||
const event = new CustomEvent('networkchange', {
|
||||
@@ -58,11 +63,12 @@ let Global = class {
|
||||
window.dispatchEvent(event)
|
||||
}
|
||||
|
||||
if(!this.currentNetwork.data) {
|
||||
if(!this.currentNetwork?.data) {
|
||||
this.currentNetwork.data = await this.fetchAppData()
|
||||
}
|
||||
|
||||
if(appChanged && !networkChanged) {
|
||||
console.log("onNavigate: app changed ->", selectedApp, "\n")
|
||||
this.currentApp = selectedApp
|
||||
const event = new CustomEvent('appchange', {
|
||||
detail: { name: this.currentApp }
|
||||
@@ -80,11 +86,13 @@ let Global = class {
|
||||
|
||||
getDefaultNetworkName() {
|
||||
let defaultNetwork = this.profile.networks[0]
|
||||
if (!defaultNetwork) { return "my"; }
|
||||
return defaultNetwork.abbreviation
|
||||
}
|
||||
|
||||
getDefaultAppName() {
|
||||
let defaultNetwork = this.profile.networks[0]
|
||||
if (!defaultNetwork) { return this.profile.apps[0].toLowerCase(); }
|
||||
return defaultNetwork.apps[0].toLowerCase()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user