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`
-
- ${regionConfig.regionDisplayName} (${formattedTierNameId})
-
+ ${regionConfig.regionDisplayName} (${formattedTierNameId})
Lobbies
diff --git a/src/elements/dev/version/version-info-matchmaker.ts b/src/elements/dev/version/version-info-matchmaker.ts
index 1892661e..370f1578 100644
--- a/src/elements/dev/version/version-info-matchmaker.ts
+++ b/src/elements/dev/version/version-info-matchmaker.ts
@@ -11,24 +11,25 @@ import { DropDownSelectEvent, DropDownSelection } from '../drop-down-list';
import { SelectBuildEvent } from '../builds';
import * as ext from './ext';
-export const HCAPTCHA_DIFFICULTIES: DropDownSelection[] = [
- {
- label: 'Easy',
- value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.Easy
- },
- {
- label: 'Moderate',
- value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.Moderate
- },
- {
- label: 'Difficult',
- value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.Difficult
- },
- {
- label: 'Always On',
- value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.AlwaysOn
- }
-];
+export const HCAPTCHA_DIFFICULTIES: DropDownSelection[] =
+ [
+ {
+ label: 'Easy',
+ value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.Easy
+ },
+ {
+ label: 'Moderate',
+ value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.Moderate
+ },
+ {
+ label: 'Difficult',
+ value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.Difficult
+ },
+ {
+ label: 'Always On',
+ value: Rivet.cloud.version.matchmaker.CaptchaHcaptchaLevel.AlwaysOn
+ }
+ ];
const PORT_PROTOCOLS: DropDownSelection[] = [
{
@@ -200,7 +201,9 @@ export default class VersionInfoMatchmaker extends LitElement {
this.updateConfig();
}
- changeHcaptchaDifficulty(event: DropDownSelectEvent) {
+ changeHcaptchaDifficulty(
+ event: DropDownSelectEvent
+ ) {
this.configExt.config.captcha.hcaptcha.level = event.selection.value;
this.updateConfig();
@@ -358,7 +361,8 @@ export default class VersionInfoMatchmaker extends LitElement {
updatePortProtocol(idx: number, event: DropDownSelectEvent) {
// Switch from target port to port range and vice versa
if (
- this.dockerRuntimeExt.ports[idx].port.protocol != Rivet.cloud.version.matchmaker.PortProtocol.Udp &&
+ this.dockerRuntimeExt.ports[idx].port.protocol !=
+ Rivet.cloud.version.matchmaker.PortProtocol.Udp &&
event.selection.value == Rivet.cloud.version.matchmaker.PortProtocol.Udp
) {
this.dockerRuntimeExt.ports[idx].port.port = undefined;
@@ -367,7 +371,8 @@ export default class VersionInfoMatchmaker extends LitElement {
max: MAX_HOST_PORT
};
} else if (
- this.dockerRuntimeExt.ports[idx].port.protocol == Rivet.cloud.version.matchmaker.PortProtocol.Udp &&
+ this.dockerRuntimeExt.ports[idx].port.protocol ==
+ Rivet.cloud.version.matchmaker.PortProtocol.Udp &&
event.selection.value != Rivet.cloud.version.matchmaker.PortProtocol.Udp
) {
this.dockerRuntimeExt.ports[idx].port.port = 80;
diff --git a/src/elements/dev/version/version-info.ts b/src/elements/dev/version/version-info.ts
index 1a7e225f..1654b531 100644
--- a/src/elements/dev/version/version-info.ts
+++ b/src/elements/dev/version/version-info.ts
@@ -1,6 +1,6 @@
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
-import { Rivet } from "@rivet-gg/api-internal";
+import { Rivet } from '@rivet-gg/api-internal';
import { cssify } from '../../../utils/css';
import styles from './version-info.scss';
import { when } from 'lit/directives/when.js';
@@ -129,8 +129,8 @@ export default class DevVersionInfo extends LitElement {
return html`
${!this.editing && this.noServices()
- ? html`
No services enabled for this version.
`
- : null}
+ ? html`
No services enabled for this version.
`
+ : null}
${when(
this.editing || this.config.cdn,
() =>
@@ -157,7 +157,7 @@ export default class DevVersionInfo extends LitElement {
>`
)}
${this.editing || this.config.kv
- ? html`
`
- : null}
+ : null}
${this.editing || this.config.identity
- ? html`
`
- : null}
+ : null}
`;
}
diff --git a/src/elements/identity/identity-profile-edit.ts b/src/elements/identity/identity-profile-edit.ts
index f1f453ba..fb3b8957 100644
--- a/src/elements/identity/identity-profile-edit.ts
+++ b/src/elements/identity/identity-profile-edit.ts
@@ -250,10 +250,7 @@ export default class IdentityProfileEdit extends LitElement {
-
+
-
+
diff --git a/src/elements/layouts/sidebar-layout.ts b/src/elements/layouts/sidebar-layout.ts
index 4f9cb472..9a62c0a2 100644
--- a/src/elements/layouts/sidebar-layout.ts
+++ b/src/elements/layouts/sidebar-layout.ts
@@ -13,7 +13,9 @@ export default class Layout extends LitElement {
return html`
-
+
diff --git a/src/elements/mod.ts b/src/elements/mod.ts
index 469f8430..14af7afd 100644
--- a/src/elements/mod.ts
+++ b/src/elements/mod.ts
@@ -62,4 +62,4 @@ import './profile/graph-view';
import './profile/user-banner';
import './root/ui-root';
import './root/ui-router';
-import './tiles/group-handle-tile';
\ No newline at end of file
+import './tiles/group-handle-tile';
diff --git a/src/elements/pages/dev-dash.ts b/src/elements/pages/dev-dash.ts
index 44d45dbe..a14145e6 100644
--- a/src/elements/pages/dev-dash.ts
+++ b/src/elements/pages/dev-dash.ts
@@ -47,7 +47,8 @@ export default class DeveloperDash extends LitElement {
render() {
return html`
${when(
- (global.currentIdentity.isAdmin) || global.currentIdentity.groups.find(group => group.group.isDeveloper),
+ global.currentIdentity.isAdmin ||
+ global.currentIdentity.groups.find(group => group.group.isDeveloper),
() => html`
@@ -57,10 +58,16 @@ export default class DeveloperDash extends LitElement {
`,
() => html`
-
+
Private Beta
Rivet is still in private beta. Join the waitlist to get early access.
@@ -70,16 +77,18 @@ export default class DeveloperDash extends LitElement {
Beta Access Form
- ${when(!global.currentIdentity.isRegistered, () => html`
+ ${when(
+ !global.currentIdentity.isRegistered,
+ () => html`
-
Have access and just got logged out?
-
-
UIRoot.shared.openRegisterPanel()}>
- Login
-
+
Have access and just got logged out?
+
+ UIRoot.shared.openRegisterPanel()}>
+ Login
+
- `)
- }
+ `
+ )}
`
)}
diff --git a/src/elements/pages/dev/game/module.ts b/src/elements/pages/dev/game/module.ts
new file mode 100644
index 00000000..c9ad2e02
--- /dev/null
+++ b/src/elements/pages/dev/game/module.ts
@@ -0,0 +1,5 @@
+import './game-banner';
+import './games';
+
+import './settings/module';
+import './pages/module';
diff --git a/src/elements/pages/dev/game/pages/game-billing.ts b/src/elements/pages/dev/game/pages/game-billing.ts
index d15ea7f1..b25c2a38 100644
--- a/src/elements/pages/dev/game/pages/game-billing.ts
+++ b/src/elements/pages/dev/game/pages/game-billing.ts
@@ -510,9 +510,7 @@ export default class DevGameBilling extends LitElement {
${when(
!this.isExporting,
() =>
- html`
Export Data `
)}
diff --git a/src/elements/pages/dev/game/pages/game-logs.ts b/src/elements/pages/dev/game/pages/game-logs.ts
index c8fdc590..5b0bf31d 100644
--- a/src/elements/pages/dev/game/pages/game-logs.ts
+++ b/src/elements/pages/dev/game/pages/game-logs.ts
@@ -433,9 +433,7 @@ export default class DevGameLogs extends LitElement {