Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/components/GuestWelcomeWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
<Check :size="20" />
</template>
</NcButton>

<div class="separator" />

<div class="login-info">
<span> {{ t('spreed', 'Do you already have an account?') }}</span>
<NcButton type="secondary"
:href="getLoginUrl()">
{{ t('spreed', 'Login') }}
</NcButton>
</div>
</div>
</NcModal>
</template>
Expand All @@ -48,6 +58,7 @@ import { ref } from 'vue'
import Check from 'vue-material-design-icons/CheckBold.vue'

import { t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
Expand Down Expand Up @@ -115,6 +126,13 @@ export default {
handleChooseUserName() {
this.guestNameStore.submitGuestUsername(this.token, this.guestUserName)
},

getLoginUrl() {
const currentUrl = window.location.pathname
const loginBaseUrl = generateUrl('/login')
const redirectUrl = encodeURIComponent(currentUrl)
return `${loginBaseUrl}?redirect_url=${redirectUrl}`
},
},
}
</script>
Expand Down Expand Up @@ -144,4 +162,16 @@ export default {
.submit-button {
margin: 0 auto;
}

.login-info {
display: flex;
align-items: center;
gap: calc(var(--default-grid-baseline) * 2);
padding-top: calc(var(--default-grid-baseline) * 2);
}

.separator {
margin: calc(var(--default-grid-baseline) * 5) 0 var(--default-grid-baseline);
border-top: 1px solid;
}
</style>
8 changes: 7 additions & 1 deletion src/components/LobbyScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use-extended-markdown />
</div>
</div>
<SetGuestUsername v-if="currentUserIsGuest" />
<SetGuestUsername v-if="currentUserIsGuest" class="guest-info" />
</div>
</template>

Expand Down Expand Up @@ -139,4 +139,10 @@ export default {
}
}

.guest-info {
display: flex;
flex-direction: column;
align-items: center;
}

</style>
25 changes: 24 additions & 1 deletion src/components/SetGuestUsername.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<NcButton v-if="!isEditingUsername"
@click="handleEditUsername">
{{ t('spreed', 'Edit') }}
{{ t('spreed', 'Edit display name') }}
<template #icon>
<Pencil :size="20" />
</template>
Expand All @@ -27,6 +27,14 @@
@trailing-button-click="handleChooseUserName"
@keydown.enter="handleChooseUserName"
@keydown.esc="handleEditUsername" />

<div class="login-info">
<span> {{ t('spreed', 'Do you already have an account?') }}</span>
<NcButton type="secondary"
:href="getLoginUrl()">
{{ t('spreed', 'Login') }}
</NcButton>
</div>
</div>
</template>

Expand All @@ -36,6 +44,7 @@ import escapeHtml from 'escape-html'
import Pencil from 'vue-material-design-icons/Pencil.vue'

import { t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
Expand Down Expand Up @@ -127,6 +136,13 @@ export default {
})
}
},

getLoginUrl() {
const currentUrl = window.location.pathname
const loginBaseUrl = generateUrl('/login')
const redirectUrl = encodeURIComponent(currentUrl)
return `${loginBaseUrl}?redirect_url=${redirectUrl}`
},
},

}
Expand All @@ -143,4 +159,11 @@ export default {
}
}

.login-info {
display: flex;
align-items: center;
gap: calc(var(--default-grid-baseline) * 2);
padding-top: calc(var(--default-grid-baseline) * 2);
}

</style>