From defc4ceb2ef0e3c1f7c8747df5b3e2fff591151d Mon Sep 17 00:00:00 2001 From: Yusuf Sallam <68395788+yusufsallam64@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:45:14 -0400 Subject: [PATCH] Refactor file tree Known issue with repeating requests --- src/config.ts | 2 +- src/elements/common/file-uploader.ts | 49 ++++---- src/elements/common/namespace-dropdown.ts | 20 ++-- src/elements/context-menu/context-menu.ts | 3 +- src/elements/dev/version-publish-summary.ts | 4 +- .../dev/version/version-info-matchmaker.ts | 47 ++++---- src/elements/dev/version/version-info.ts | 14 +-- .../identity/identity-profile-edit.ts | 5 +- src/elements/identity/identity-tile.ts | 5 +- src/elements/layouts/sidebar-layout.ts | 4 +- src/elements/mod.ts | 2 +- src/elements/pages/dev-dash.ts | 35 +++--- src/elements/pages/dev/game/module.ts | 5 + .../pages/dev/game/pages/game-billing.ts | 4 +- .../pages/dev/game/pages/game-logs.ts | 4 +- .../pages/dev/game/pages/game-overview.ts | 19 ++-- .../dev/game/pages/game-version-draft.ts | 43 +++---- .../pages/dev/game/pages/game-version.ts | 18 +-- src/elements/pages/dev/game/pages/module.ts | 9 ++ .../pages/dev/game/settings/game-settings.ts | 10 +- .../pages/dev/game/settings/module.ts | 4 + .../pages/{ => dev/group}/group-banner.ts | 6 +- .../pages/{ => dev/group}/group-invite.scss | 4 +- .../pages/{ => dev/group}/group-invite.ts | 12 +- src/elements/pages/{ => dev/group}/group.scss | 7 +- src/elements/pages/{ => dev/group}/group.ts | 67 +++++------ src/elements/pages/dev/group/module.ts | 5 + .../group/settings}/group-settings-billing.ts | 4 +- .../group/settings}/group-settings-general.ts | 34 +++--- .../settings}/group-settings-members.scss | 0 .../group/settings}/group-settings-members.ts | 22 ++-- .../group/settings}/group-settings.ts | 14 +-- .../pages/dev/group/settings/module.ts | 4 + src/elements/pages/dev/module.ts | 25 +---- src/elements/pages/dev/namespace/module.ts | 4 + .../pages/{ => dev/user}/consent.scss | 2 +- src/elements/pages/{ => dev/user}/consent.ts | 4 +- src/elements/pages/dev/user/module.ts | 2 + .../pages/{ => dev/user}/settings.scss | 4 +- src/elements/pages/{ => dev/user}/settings.ts | 105 ++++++------------ src/elements/pages/module.ts | 12 +- src/routes.ts | 14 ++- src/utils/auth.ts | 4 +- src/utils/global.ts | 5 +- 44 files changed, 328 insertions(+), 338 deletions(-) create mode 100644 src/elements/pages/dev/game/module.ts create mode 100644 src/elements/pages/dev/game/pages/module.ts create mode 100644 src/elements/pages/dev/game/settings/module.ts rename src/elements/pages/{ => dev/group}/group-banner.ts (90%) rename src/elements/pages/{ => dev/group}/group-invite.scss (96%) rename src/elements/pages/{ => dev/group}/group-invite.ts (92%) rename src/elements/pages/{ => dev/group}/group.scss (99%) rename src/elements/pages/{ => dev/group}/group.ts (92%) create mode 100644 src/elements/pages/dev/group/module.ts rename src/elements/pages/{ => dev/group/settings}/group-settings-billing.ts (92%) rename src/elements/pages/{ => dev/group/settings}/group-settings-general.ts (92%) rename src/elements/pages/{ => dev/group/settings}/group-settings-members.scss (100%) rename src/elements/pages/{ => dev/group/settings}/group-settings-members.ts (97%) rename src/elements/pages/{ => dev/group/settings}/group-settings.ts (92%) create mode 100644 src/elements/pages/dev/group/settings/module.ts create mode 100644 src/elements/pages/dev/namespace/module.ts rename src/elements/pages/{ => dev/user}/consent.scss (97%) rename src/elements/pages/{ => dev/user}/consent.ts (92%) create mode 100644 src/elements/pages/dev/user/module.ts rename src/elements/pages/{ => dev/user}/settings.scss (98%) rename src/elements/pages/{ => dev/user}/settings.ts (74%) diff --git a/src/config.ts b/src/config.ts index b8b9f4fc..3b1593bc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -16,7 +16,7 @@ const config = { ORIGIN_API: RIVET_ORIGIN_API as string, ASSETS_URL: ENV_ASSETS_URL as string, - MEDIA_URL: RIVET_ORIGIN_API + "/media", + MEDIA_URL: RIVET_ORIGIN_API + '/media', API_AUTH_URL: modifyBaseUrl(RIVET_ORIGIN_API, 'auth.', '/v1'), API_PORTAL_URL: modifyBaseUrl(RIVET_ORIGIN_API, 'portal.', '/v1'), diff --git a/src/elements/common/file-uploader.ts b/src/elements/common/file-uploader.ts index c07a22c8..d1ca9e2e 100644 --- a/src/elements/common/file-uploader.ts +++ b/src/elements/common/file-uploader.ts @@ -325,8 +325,8 @@ export default class FileUploader extends LitElement { ? this.uploadState.type == 'uploading' ? this.uploadState.progress / this.uploadState.total : this.uploadState.type == 'completing' - ? 1 - : 0 + ? 1 + : 0 : 0; // Separate file type from current upload @@ -346,8 +346,8 @@ export default class FileUploader extends LitElement { let accept = this.video ? 'video/mp4,video/x-m4v,video/*' : this.image - ? 'image/*' - : this.accept ?? null; + ? 'image/*' + : this.accept ?? null; return html`
e.preventDefault()}> @@ -356,53 +356,54 @@ export default class FileUploader extends LitElement { ${when( - this.uploadError, - () => - html`

+ this.uploadError, + () => + html`

${when( - typeof this.uploadError == 'string', - () => this.uploadError, - () => html`Error while uploading. Please try again.

` - )} + typeof this.uploadError == 'string', + () => this.uploadError, + () => html`Error while uploading. Please try again.` + )} ` - )} + )}
${uploading - ? html`
+ ? html`
${this.uploadState.type == 'preparing' - ? html`

+ ? html`

Preparing ${this.uploadState.count} file${this.uploadState.count == 1 ? '' : 's'}...

` - : null} + : null} ${this.uploadState.type == 'uploading' - ? html` + ? html`

Uploading...

-

${currentUpload[0].repeat(2)}${currentUpload[1] - }

+

${currentUpload[0].repeat(2)}${ + currentUpload[1] + }

${this.uploadState.progress}/${this.uploadState.total}

` - : null} + : null} ${this.uploadState.type == 'completing' - ? html`

Completing upload...

+ ? html`

Completing upload...

` - : null} + : null}
` - : null} + : null} ${this.dragActive && !uploading - ? html`
Drag and drop files here
` - : null} + ? html`
Drag and drop files here
` + : null}
${namespace.displayName}
+ ? html` ` + : html``} --> `; } @@ -85,11 +85,11 @@ export default class RichEmbed extends LitElement { aria-expanded=${this.expanded} > ${this.game.namespaces.map(namespace => { - return this.renderNamespaceListEntry( - namespace, - namespace.namespaceId === this.currentNamespace.namespaceId - ); - })} + return this.renderNamespaceListEntry( + namespace, + namespace.namespaceId === this.currentNamespace.namespaceId + ); + })}
diff --git a/src/elements/context-menu/context-menu.ts b/src/elements/context-menu/context-menu.ts index eb85ff94..d417776a 100644 --- a/src/elements/context-menu/context-menu.ts +++ b/src/elements/context-menu/context-menu.ts @@ -202,8 +202,7 @@ export default class ContextMenu extends LitElement { let showAdminControls = !isSelf && ctx.selfIsOwner; - return html` - ${when( + return html` ${when( showAdminControls, () => html`
diff --git a/src/elements/dev/version-publish-summary.ts b/src/elements/dev/version-publish-summary.ts index 86699cdd..d0efb586 100644 --- a/src/elements/dev/version-publish-summary.ts +++ b/src/elements/dev/version-publish-summary.ts @@ -100,9 +100,7 @@ export default class VersionPublishSumary extends LitElement { return html`