Skip to content

Commit

Permalink
Capacity changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Natsumi-sama committed Sep 12, 2023
1 parent 180a4cd commit 378385b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
49 changes: 47 additions & 2 deletions html/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,7 @@ speechSynthesis.getVoices();
authorId: '',
authorName: '',
capacity: 0,
recommendedCapacity: 0,
tags: [],
releaseStatus: '',
imageUrl: '',
Expand Down Expand Up @@ -12357,14 +12358,14 @@ speechSynthesis.getVoices();
if (ref) {
L.worldName = ref.name;
L.thumbnailImageUrl = ref.thumbnailImageUrl;
L.worldCapacity = ref.capacity * 2;
L.worldCapacity = ref.capacity;
} else {
API.getWorld({
worldId: L.worldId
}).then((args) => {
L.worldName = args.ref.name;
L.thumbnailImageUrl = args.ref.thumbnailImageUrl;
L.worldCapacity = args.ref.capacity * 2;
L.worldCapacity = args.ref.capacity;
return args;
});
}
Expand Down Expand Up @@ -15585,6 +15586,42 @@ speechSynthesis.getVoices();
);
};

$app.methods.promptChangeWorldRecommendedCapacity = function (world) {
this.$prompt(
$t('prompt.change_world_recommended_capacity.description'),
$t('prompt.change_world_recommended_capacity.header'),
{
distinguishCancelAndClose: true,
confirmButtonText: $t('prompt.change_world_capacity.ok'),
cancelButtonText: $t('prompt.change_world_capacity.cancel'),
inputValue: world.ref.recommendedCapacity,
inputPattern: /\d+$/,
inputErrorMessage: $t(
'prompt.change_world_recommended_capacity.input_error'
),
callback: (action, instance) => {
if (
action === 'confirm' &&
instance.inputValue !== world.ref.recommendedCapacity
) {
API.saveWorld({
id: world.id,
recommendedCapacity: instance.inputValue
}).then((args) => {
this.$message({
message: $t(
'prompt.change_world_recommended_capacity.message.success'
),
type: 'success'
});
return args;
});
}
}
}
);
};

$app.methods.promptChangeWorldYouTubePreview = function (world) {
this.$prompt(
$t('prompt.change_world_preview.description'),
Expand Down Expand Up @@ -17943,6 +17980,9 @@ speechSynthesis.getVoices();
case 'Change Capacity':
this.promptChangeWorldCapacity(D);
break;
case 'Change Recommended Capacity':
this.promptChangeWorldRecommendedCapacity(D);
break;
case 'Change YouTube Preview':
this.promptChangeWorldYouTubePreview(D);
break;
Expand Down Expand Up @@ -27041,6 +27081,11 @@ speechSynthesis.getVoices();
json.world = args1.ref;
return args1;
});
// get queue size etc
this.getInstance({
worldId: json.worldId,
instanceId: json.instanceId
});
}
});

Expand Down
7 changes: 4 additions & 3 deletions html/src/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ html
.detail
span.name
span(v-text="ref.group.name")
span(style="font-weight:normal;margin-left:5px") ({{ ref.instance.userCount }}/{{ ref.instance.capacity }})
span(style="font-weight:normal;margin-left:5px") ({{ ref.instance.n_users }}/{{ ref.instance.capacity }})
location.extra(:location="ref.instance.location" :link="false")


Expand Down Expand Up @@ -610,6 +610,7 @@ html
el-dropdown-item(icon="el-icon-edit" command="Rename") {{ $t('dialog.world.actions.rename') }}
el-dropdown-item(icon="el-icon-edit" command="Change Description") {{ $t('dialog.world.actions.change_description') }}
el-dropdown-item(icon="el-icon-edit" command="Change Capacity") {{ $t('dialog.world.actions.change_capacity') }}
el-dropdown-item(icon="el-icon-edit" command="Change Recommended Capacity") {{ $t('dialog.world.actions.change_recommended_capacity') }}
el-dropdown-item(icon="el-icon-edit" command="Change YouTube Preview") {{ $t('dialog.world.actions.change_preview') }}
el-dropdown-item(icon="el-icon-edit" command="Change Tags") {{ $t('dialog.world.actions.change_tags') }}
el-dropdown-item(icon="el-icon-picture-outline" command="Change Image") {{ $t('dialog.world.actions.change_image') }}
Expand All @@ -622,7 +623,7 @@ html
div.
#[i.el-icon-user] {{ $t('dialog.world.instances.public_count', { count: worldDialog.ref.publicOccupants }) }}
#[i.el-icon-user-solid(style="margin-left:10px")] {{ $t('dialog.world.instances.private_count', { count: worldDialog.ref.privateOccupants }) }}
#[i.el-icon-check(style="margin-left:10px")] {{ $t('dialog.world.instances.capacity_count', { count: worldDialog.ref.capacity, max: worldDialog.ref.capacity * 2 }) }}
#[i.el-icon-check(style="margin-left:10px")] {{ $t('dialog.world.instances.capacity_count', { count: worldDialog.ref.recommendedCapacity, max: worldDialog.ref.capacity }) }}
div(v-for="room in worldDialog.rooms" :key="room.id")
div(style="margin:5px 0")
location-world(:locationobject="room.$location" :currentuserid="API.currentUser.id" :worlddialogshortname="worldDialog.$location.shortName")
Expand Down Expand Up @@ -693,7 +694,7 @@ html
.x-friend-item(style="cursor:default")
.detail
span.name {{ $t('dialog.world.info.capacity') }}
span.extra {{ worldDialog.ref.capacity | commaNumber }} ({{ worldDialog.ref.capacity * 2 | commaNumber }})
span.extra {{ worldDialog.ref.recommendedCapacity | commaNumber }} ({{ worldDialog.ref.capacity | commaNumber }})
.x-friend-item(style="cursor:default")
.detail
span.name {{ $t('dialog.world.info.heat') }}
Expand Down
13 changes: 12 additions & 1 deletion html/src/localization/strings/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@
"rename": "Rename",
"change_description": "Change Description",
"change_capacity": "Change Capacity",
"change_recommended_capacity": "Change Recommended Capacity",
"change_preview": "Change Youtube Preview",
"change_tags": "Change Tags",
"change_image": "Change Image",
Expand Down Expand Up @@ -1330,14 +1331,24 @@
},
"change_world_capacity": {
"header": "Change Capacity",
"description": "Enter world capacity, Max: 40",
"description": "Enter world capacity (hard cap), Max: 80",
"cancel": "Cancel",
"ok": "OK",
"input_error": "Valid number is required",
"message": {
"success": "World capacity changed"
}
},
"change_world_recommended_capacity": {
"header": "Change Recommended Capacity",
"description": "Enter world recommended capacity (soft cap)",
"cancel": "Cancel",
"ok": "OK",
"input_error": "Valid number is required",
"message": {
"success": "World recommended capacity changed"
}
},
"change_world_preview": {
"header": "Change YouTube Preview",
"description": "Enter world YouTube preview",
Expand Down

0 comments on commit 378385b

Please sign in to comment.