diff --git a/src/components/popover/popover.scss b/src/components/popover/popover.scss new file mode 100644 index 000000000..9ec1ff110 --- /dev/null +++ b/src/components/popover/popover.scss @@ -0,0 +1,105 @@ +.popover-trigger-button { + display: inline-block; +} + +.popover { + z-index: var(--ZI_popover_override, var(--ZI_popovers)); + position: fixed; + min-width: 0; + max-width: calc(100vw - 20px); + box-shadow: var(--shadow); +} + +.popover-default { + &::after { + content: ""; + position: absolute; + top: -1px; + bottom: -1px; + left: -1px; + right: -1px; + z-index: -1px; + box-shadow: var(--shadow); + pointer-events: none; + } + + border-radius: var(--roundness); + border-color: var(--border); + border-style: solid; + border-width: 1px; + background-color: var(--background); +} + +.dropdown-menu { + display: block; + padding: 0; + font-size: 1em; + text-align: left; + list-style: none; + max-width: 100vw; + z-index: var(--ZI_popover_override, var(--ZI_popovers)); + white-space: nowrap; + background-color: var(--background); + + .dropdown-divider { + height: 0; + margin: 0.5rem 0; + overflow: hidden; + border-top: 1px solid var(--border); + } + + .dropdown-item:not(button, a) { + padding: 0; + } + + a.dropdown-item, + button.dropdown-item, + .dropdown-item:not(button, a) > button:first-child, + .dropdown-item:not(button, a) > a:first-child { + box-sizing: border-box; + padding: var(--__horizontal-gap) var(--__horizontal-gap); + grid-gap: var(--__horizontal-gap); + display: grid; + border: none; + align-items: center; + grid-template-columns: 1fr var(--__line-height); + grid-auto-flow: column; + grid-auto-columns: auto; + cursor: pointer; + + .menu-checkbox { + display: inline-block; + vertical-align: middle; + min-width: calc(var(--__line-height) + 1px); + max-width: calc(var(--__line-height) + 1px); + min-height: calc(var(--__line-height) + 1px); + max-height: calc(var(--__line-height) + 1px); + line-height: var(--__line-height); + text-align: center; + border-radius: 0; + box-shadow: var(--shadow); + margin-right: var(--__horizontal-gap); + + &.menu-checkbox-checked::after { + font-size: 1.25em; + content: "✓"; + } + + &.-radio { + border-radius: 9999px; + + &.menu-checkbox-checked::after { + font-size: 2em; + content: "•"; + } + } + } + } + + a.dropdown-item-icon, + button.dropdown-item-icon, + .dropdown-item-icon:not(button, a) > button:first-child, + .dropdown-item-icon:not(button, a) > a:first-child { + grid-template-columns: var(--__line-height) 1fr; + } +} diff --git a/src/components/popover/popover.vue b/src/components/popover/popover.vue index 0c5b372ee..b9f7cfc00 100644 --- a/src/components/popover/popover.vue +++ b/src/components/popover/popover.vue @@ -41,101 +41,4 @@ - + diff --git a/src/components/user_list_menu/user_list_menu.js b/src/components/user_list_menu/user_list_menu.js index 21996031b..a36b7bd6e 100644 --- a/src/components/user_list_menu/user_list_menu.js +++ b/src/components/user_list_menu/user_list_menu.js @@ -34,6 +34,11 @@ const UserListMenu = { ...list, inList: this.inListsSet.has(list.id) })) + }, + triggerAttrs () { + return { + class: 'menu-item dropdown-item -has-submenu' + } } }, methods: { diff --git a/src/components/user_list_menu/user_list_menu.vue b/src/components/user_list_menu/user_list_menu.vue index 39ee24519..b06eeb620 100644 --- a/src/components/user_list_menu/user_list_menu.vue +++ b/src/components/user_list_menu/user_list_menu.vue @@ -3,6 +3,7 @@ diff --git a/src/modules/serverSideStorage.js b/src/modules/serverSideStorage.js index 345cd86a0..6ac63a273 100644 --- a/src/modules/serverSideStorage.js +++ b/src/modules/serverSideStorage.js @@ -9,8 +9,7 @@ import { groupBy, findLastIndex, takeRight, - uniqWith, - merge + uniqWith } from 'lodash' import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js' @@ -124,10 +123,21 @@ export const _getRecentData = (cache, live) => { result.needUpload = true } - result.recent = merge(defaultState, result.recent) - result.stale = merge(defaultState, result.stale) + const merge = (a, b) => ({ + needUpload: b.needUpload ?? a.needUpload, + prefsStorage: { + ...a.prefsStorage, + ...b.prefsStorage + }, + flagStorage: { + ...a.flagStorage, + ...b.flagStorage + } + }) + result.recent = result.recent && merge(defaultState, result.recent) + result.stale = result.stale && merge(defaultState, result.stale) - return merge(defaultState, result) + return result } export const _getAllFlags = (recent, stale) => { @@ -309,7 +319,7 @@ export const mutations = { cache = _doMigrations(cache) - let { recent, stale, needsUpload } = _getRecentData(cache, live) + let { recent, stale, needUpload } = _getRecentData(cache, live) const userNew = userData.created_at > NEW_USER_DATE const flagsTemplate = userNew ? newUserFlags : defaultState.flagStorage @@ -323,7 +333,7 @@ export const mutations = { }) } - if (!needsUpload && recent && stale) { + if (!needUpload && recent && stale) { console.debug('Checking if data needs merging...') // discarding timestamps and versions const { _timestamp: _0, _version: _1, ...recentData } = recent @@ -352,7 +362,7 @@ export const mutations = { recent.flagStorage = { ...flagsTemplate, ...totalFlags } recent.prefsStorage = { ...defaultState.prefsStorage, ...totalPrefs } - state.dirty = dirty || needsUpload + state.dirty = dirty || needUpload state.cache = recent // set local timestamp to smaller one if we don't have any changes if (stale && recent && !state.dirty) {