diff --git a/frontend/src/components/orgs-list.ts b/frontend/src/components/orgs-list.ts
index 344d0724..2f291ba8 100644
--- a/frontend/src/components/orgs-list.ts
+++ b/frontend/src/components/orgs-list.ts
@@ -1,6 +1,6 @@
import { localized, msg, str } from "@lit/localize";
import type { SlChangeEvent, SlInput } from "@shoelace-style/shoelace";
-import { html, type TemplateResult } from "lit";
+import { css, html, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators.js";
import { when } from "lit/directives/when.js";
@@ -8,12 +8,18 @@ import { TailwindElement } from "@/classes/TailwindElement";
import type { Dialog } from "@/components/ui/dialog";
import { APIController } from "@/controllers/api";
import { NavigateController } from "@/controllers/navigate";
-import type { CurrentUser, UserOrg } from "@/types/user";
+import type { CurrentUser } from "@/types/user";
+import { formatNumber } from "@/utils/localization";
import type { OrgData } from "@/utils/orgs";
@localized()
@customElement("btrix-orgs-list")
export class OrgsList extends TailwindElement {
+ static styles = css`
+ btrix-table {
+ grid-template-columns: [clickable-start] auto auto [clickable-end] min-content;
+ }
+ `;
@property({ type: Object })
userInfo?: CurrentUser;
@@ -43,14 +49,20 @@ export class OrgsList extends TailwindElement {
return this.renderSkeleton();
}
- const defaultOrg = this.userInfo?.orgs.find((org) => org.default === true);
-
return html`
-
- ${this.orgList?.map(this.renderOrg(defaultOrg))}
- ${this.renderOrgDelete()}
- ${this.renderOrgQuotas()}
-
+
+
+ ${msg("Name")}
+ ${msg("Members")}
+
+ ${msg("Actions")}
+
+
+
+ ${this.orgList?.map(this.renderOrg)}
+
+
+ ${this.renderOrgDelete()} ${this.renderOrgQuotas()}
`;
}
@@ -229,40 +241,31 @@ export class OrgsList extends TailwindElement {
}
}
- private readonly renderOrg = (defaultOrg?: UserOrg) => (org: OrgData) => {
+ private readonly renderOrg = (org: OrgData) => {
if (!this.userInfo) return;
- // There shouldn't really be a case where an org is in the org list but
- // not in user info, but disable clicking into the org just in case
- const isUserOrg = this.userInfo.orgs.some(({ id }) => id === org.id);
+ // // There shouldn't really be a case where an org is in the org list but
+ // // not in user info, but disable clicking into the org just in case
+ // const isUserOrg = this.userInfo.orgs.some(({ id }) => id === org.id);
- let defaultLabel: TemplateResult | undefined;
-
- if (defaultOrg && org.id === defaultOrg.id) {
- defaultLabel = html`${msg("Default")}`;
- }
const memberCount = Object.keys(org.users || {}).length;
return html`
-
-
- ${defaultLabel}${org.name}
-
-
-
+
+
`;
};
@@ -302,21 +305,4 @@ export class OrgsList extends TailwindElement {
`;
}
-
- private makeOnOrgClick(org: OrgData) {
- const navigate = () => this.navigate.to(`/orgs/${org.slug}`);
-
- if (typeof window.getSelection !== "undefined") {
- return () => {
- // Prevent navigation on user text selection
- if (window.getSelection()?.type === "Range") {
- return;
- }
-
- navigate();
- };
- }
-
- return navigate;
- }
}
diff --git a/frontend/src/types/org.ts b/frontend/src/types/org.ts
index d3020d94..38a56cf4 100644
--- a/frontend/src/types/org.ts
+++ b/frontend/src/types/org.ts
@@ -17,6 +17,7 @@ export type OrgData = {
id: string;
name: string;
slug: string;
+ default: boolean;
quotas?: Record;
bytesStored: number;
bytesStoredCrawls: number;