+
${this.authService.authState
- ? html`
-
+ ? html` ${this.renderTeams()}
+
+
-
-
- ${isAdmin
- ? html`
-
- ${msg("admin")}
-
- `
+
+ ${this.renderMenuUserInfo()}
+
+ this.navigate(ROUTES.accountSettings)}
+ >
+
+ ${msg("Account Settings")}
+
+ ${this.userInfo?.isAdmin
+ ? html` this.navigate(ROUTES.usersInvite)}
+ >
+
+ ${msg("Invite Users")}
+ `
: ""}
-
- ${this.userInfo?.name}
-
-
- ${this.userInfo?.email}
-
-
-
- this.navigate(ROUTES.accountSettings)}
- >
-
- ${msg("Your account")}
-
- ${this.userInfo?.isAdmin
- ? html` this.navigate(ROUTES.usersInvite)}
- >
-
- ${msg("Invite Users")}
- `
- : ""}
-
-
-
- ${msg("Log Out")}
-
-
- `
+
+
+
+ ${msg("Log Out")}
+
+
+ `
: html`
${msg("Log In")}
${this.isRegistrationEnabled
@@ -314,7 +347,91 @@ export class App extends LiteElement {
`;
}
- renderFooter() {
+ private renderTeams() {
+ if (!this.teams || this.teams.length < 2 || !this.userInfo) return;
+
+ const selectedOption = this.selectedTeamId
+ ? this.teams.find(({ id }) => id === this.selectedTeamId)
+ : { id: "", name: msg("All Teams") };
+ if (!selectedOption) {
+ console.debug(
+ `Could't find team with ID ${this.selectedTeamId}`,
+ this.teams
+ );
+ return;
+ }
+
+ return html`
+
+ ${selectedOption.name}
+ {
+ const { value } = e.detail.item;
+ this.navigate(`/archives/${value}${value ? "/crawls" : ""}`);
+ }}
+ >
+ ${when(
+ this.userInfo.isAdmin,
+ () => html`
+ ${msg("All Teams")}
+
+ `
+ )}
+ ${this.teams.map(
+ (team) => html`
+ ${team.name}
+ `
+ )}
+
+
+ `;
+ }
+
+ private renderMenuUserInfo() {
+ if (!this.userInfo) return;
+ if (this.userInfo.isAdmin) {
+ return html`
+
+ ${msg("admin")}
+
+
${this.userInfo?.name}
+
+ ${this.userInfo?.email}
+
+ `;
+ }
+
+ if (this.teams?.length === 1) {
+ return html`
+
+ ${this.teams![0].name}
+
+
${this.userInfo?.name}
+
+ ${this.userInfo?.email}
+
+ `;
+ }
+
+ return html`
+
${this.userInfo?.name}
+
+ ${this.userInfo?.email}
+
+ `;
+ }
+
+ private renderFooter() {
return html`