Skip to content

Commit

Permalink
feat: ux improvements on room compose
Browse files Browse the repository at this point in the history
  • Loading branch information
selimdoyranli committed Feb 29, 2024
1 parent b965449 commit fa32583
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
Dialog.dialog.creator-mode-created-room-dialog(
v-model="state.isOpen"
:title="$t('dialog.createdRoom.title')"
:confirm-button-text="confirmButtonText || $t('general.ok')"
:cancel-button-text="cancelButtonText || $t('general.close')"
:show-confirm-button="false"
:show-confirm-button="true"
:show-cancel-button="true"
:close-on-click-overlay="false"
@closed="$emit('closed')"
@opened="$emit('opened')"
@cancel="$emit('onCancel')"
@confirm="$emit('onConfirm')"
)
h4.creator-mode-created-room-dialog__roomTitle {{ room.title }}

template(v-if="room.isListed")
p(v-html="$t('dialog.createdRoom.isListedMessage', { isListed: $t('dialog.createdRoom.public') })")
template(v-else)
p(v-html="$t('dialog.createdRoom.isListedMessage', { isListed: $t('dialog.createdRoom.private') })")

Field.creator-mode-created-room-dialog__roomIdField(
:value="`${APP_URL}${localePath({ name: 'CreatorMode-CreatorModeRoom', query: { id: room.id } })}`"
disabled
Expand Down Expand Up @@ -39,6 +48,11 @@ export default defineComponent({
required: false,
default: false
},
confirmButtonText: {
type: String,
required: false,
default: null
},
cancelButtonText: {
type: String,
required: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ Form.creator-mode-compose-form(@keypress.enter.prevent @failed="handleFailed")

CreatorModeCreatedRoomDialog(
:isOpen="dialog.room.isOpen"
:cancelButtonText="$t('dialog.createdRoom.joinRoom')"
:confirmButtonText="$t('dialog.createdRoom.joinRoom')"
:room="createdRoom"
@onConfirm="handleConfirmRoomDialog"
@closed="handleCloseRoomDialog"
)
</template>
Expand Down Expand Up @@ -188,14 +189,15 @@ export default defineComponent({
isBusy: false,
isClear: false,
roomTitle: '',
isListed: true,
isListed: false,
isAnon: false,
qaList: []
})
const createdRoom = reactive({
title: '',
id: ''
id: '',
isListed: form.isListed
})
const dialog = reactive({
Expand Down Expand Up @@ -331,11 +333,10 @@ export default defineComponent({
if (result.success) {
createdRoom.title = result.data.title
createdRoom.id = result.data.room
createdRoom.isListed = form.isListed
dialog.room.isOpen = true
resetForm()
let storagedMyRooms = JSON.parse(window.localStorage.getItem('myRooms'))
if (storagedMyRooms && storagedMyRooms.length > 0) {
Expand All @@ -355,7 +356,7 @@ export default defineComponent({
const resetForm = () => {
form.roomTitle = ''
form.isListed = true
form.isListed = false
form.isAnon = false
form.qaList = []
}
Expand Down Expand Up @@ -389,7 +390,7 @@ export default defineComponent({
resetForm()
}
const handleCloseRoomDialog = () => {
const handleConfirmRoomDialog = () => {
router.push(
localePath({
name: 'CreatorMode-CreatorModeRoom',
Expand All @@ -398,6 +399,10 @@ export default defineComponent({
)
}
const handleCloseRoomDialog = () => {
dialog.room.isOpen = false
}
watch(form, value => {
if (value.qaList && value.qaList.length > 0) {
saveDraft()
Expand All @@ -423,6 +428,7 @@ export default defineComponent({
deleteDraft,
createdRoom,
dialog,
handleConfirmRoomDialog,
handleCloseRoomDialog
}
}
Expand Down
3 changes: 3 additions & 0 deletions locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export default {
createdRoom: {
title: 'Room created',
joinRoom: 'Join room',
isListedMessage: `Your room {isListed} has been created. If you published with the wrong option, you can close this window, edit, and send it again.`,
public: '<strong>WILL APPEAR IN ROOM LIST</strong>',
private: '<strong>PRIVATE</strong>',
copyUrl: {
callback: {
success: 'Copied room URL'
Expand Down
5 changes: 4 additions & 1 deletion locales/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export default {
createdRoom: {
title: 'Oda oluşturuldu',
joinRoom: 'Odaya git',
isListedMessage: `Odan {isListed} oluşturuldu. Yanlış seçenekle yayınladıysan bu pencereyi kapattıktan sonra düzenleyip tekrar gönderebilirsin.`,
public: '<strong>ODA LİSTESİNDE GÖRÜNECEK</strong> şekilde',
private: '<strong>GİZLİ</strong> olarak',
copyUrl: {
callback: {
success: 'Oda bağlantısı kopyalandı'
Expand Down Expand Up @@ -273,7 +276,7 @@ export default {
placeholder: 'Oda başlığı yaz'
},
isListed: {
label: 'Açık odalarda listensin mi?'
label: 'Odan odalar listesinde görünsün mü?'
},
isAnon: {
label: 'Oluşturan oyuncu adın gizlensin mi?'
Expand Down

0 comments on commit fa32583

Please sign in to comment.