Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2022-05-25 14:31:51 +02:00
Родитель e1c0134640
Коммит a078ae92ed
3 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -109,7 +109,6 @@ import {
import { SyncService, ERROR_TYPE, IDLE_TIMEOUT } from './../services/SyncService.js'
import ImageResolver from './../services/ImageResolver.js'
import { getRandomGuestName } from './../helpers/index.js'
import { extensionHighlight } from '../helpers/mappings.js'
import { createEditor, serializePlainText, loadSyntaxHighlight } from './../EditorFactory.js'
import { createMarkdownSerializer } from './../extensions/Markdown.js'
@ -361,8 +360,7 @@ export default {
this.$parent.$emit('error', 'No valid file provided')
return
}
const guestName = localStorage.getItem('nick') ? localStorage.getItem('nick') : getRandomGuestName()
const guestName = localStorage.getItem('nick') ? localStorage.getItem('nick') : ''
this.$syncService = new SyncService({
guestName,

Просмотреть файл

@ -55,7 +55,10 @@
:disable-tooltip="true"
:size="32" />
</div>
{{ session.guestName ? session.guestName : session.displayName }}
<span class="session-label">
{{ session.userId ? session.displayName : (session.guestName ? session.guestName : t('text', 'Guest')) }}
</span>
<span v-if="session.userId === null" class="guest-label">({{ t('text', 'guest') }})</span>
</li>
</ul>
<input id="toggle-color-annotations"
@ -200,6 +203,14 @@ export default {
width: 32px;
margin-right: 6px;
}
.session-label {
padding-right: 3px;
}
.guest-label {
padding-left: 3px;
color: var(--color-text-maxcontrast);
}
}
}

Просмотреть файл

@ -44,13 +44,7 @@ const endpointUrl = (endpoint, isPublic = false) => {
return `${_baseUrl}/${endpoint}`
}
const randomGuestNames = ['Artichoke', 'Arugula', 'Asparagus', 'Avocado', 'Bamboo Shoot', 'Bean Sprout', 'Bean', 'Beet', 'Belgian Endive', 'Bell Pepper', 'Bitter Melon', 'Bitter Gourd', 'Bok Choy', 'Broccoli', 'Brussels Sprout', 'Burdock Root', 'Cabbage', 'Calabash', 'Caper', 'Carrot', 'Cassava', 'Cauliflower', 'Celery', 'Celery Root', 'Celtuce', 'Chayote', 'Chinese Broccoli', 'Corn', 'Baby Corn', 'Cucumber', 'English Cucumber', 'Gherkin', 'Pickling Cucumber', 'Daikon Radish', 'Edamame', 'Eggplant', 'Elephant Garlic', 'Endive', 'Curly', 'Escarole', 'Fennel', 'Fiddlehead', 'Galangal', 'Garlic', 'Ginger', 'Grape Leave', 'Green Bean', 'Wax Bean', 'Green', 'Amaranth Leave', 'Beet Green', 'Collard Green', 'Dandelion Green', 'Kale', 'Kohlrabi Green', 'Mustard Green', 'Rapini', 'Spinach', 'Swiss Chard', 'Turnip Green', 'Hearts of Palm', 'Horseradish', 'Jerusalem Artichoke', 'Jícama', 'Kale', 'Curly', 'Lacinato', 'Ornamental', 'Kohlrabi', 'Leeks', 'Lemongrass', 'Lettuce', 'Butterhead', 'Iceberg', 'Leaf', 'Romaine', 'Lotus Root', 'Lotus Seed', 'Mushroom', 'Napa Cabbage', 'Nopales', 'Okra', 'Olive', 'Onion', 'Green Onion', 'Parsley', 'Parsley Root', 'Parsnip', 'Pepper', 'Plantain', 'Potato', 'Pumpkin', 'Purslane', 'Radicchio', 'Radish', 'Rutabaga', 'Shallots', 'Spinach', 'Squash', 'Sweet Potato', 'Swiss Chard', 'Taro', 'Tomatillo', 'Tomato', 'Turnip', 'Water Chestnut', 'Water Spinach', 'Watercress', 'Winter Melon', 'Yams', 'Zucchini']
const getRandomGuestName = () => {
return randomGuestNames[Math.floor(Math.random() * randomGuestNames.length)]
}
export {
documentReady,
endpointUrl,
getRandomGuestName,
}