Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purge config option options.sidebar.exif.showLocation #11226

Merged
merged 2 commits into from
Jul 18, 2024
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
41 changes: 19 additions & 22 deletions packages/web-app-files/src/components/SideBar/Exif/ExifPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@
<dd data-testid="exif-panel-orientation" v-text="orientation" />
<dt v-text="$gettext('Taken time')" />
<dd data-testid="exif-panel-takenDateTime" v-text="takenDateTime" />
<template v-if="isLocationVisible">
<dt v-text="$gettext('Location')" />
<dd v-if="isCopyToClipboardAvailable" data-testid="exif-panel-location">
<span>{{ location }}</span>
<oc-button
v-if="location"
v-oc-tooltip="copyLocationToClipboardLabel"
size="small"
appearance="raw"
class="oc-ml-s"
:aria-label="copyLocationToClipboardLabel"
@click="copyLocationToClipboard"
>
<oc-icon size="small" :name="isCopiedToClipboard ? 'checkbox-circle' : 'file-copy'" />
</oc-button>
</dd>
<dd v-else data-testid="exif-panel-location" v-text="location" />
</template>
<dt v-text="$gettext('Location')" />
<dd v-if="isCopyToClipboardAvailable" data-testid="exif-panel-location">
<span>{{ location }}</span>
<oc-button
v-if="location"
v-oc-tooltip="copyLocationToClipboardLabel"
size="small"
appearance="raw"
class="oc-ml-s"
:aria-label="copyLocationToClipboardLabel"
@click="copyLocationToClipboard"
>
<oc-icon size="small" :name="isCopiedToClipboard ? 'checkbox-circle' : 'file-copy'" />
</oc-button>
</dd>
<dd v-else data-testid="exif-panel-location" v-text="location" />
</dl>
</div>
</template>
Expand Down Expand Up @@ -114,9 +112,6 @@ export default defineComponent({
return photo?.takenDateTime ? formatDateFromISO(photo.takenDateTime, language.current) : '-'
})

const isLocationVisible = computed(() => {
return config.options.sidebar?.exif?.showLocation !== false
})
const location = computed(() => {
const l = unref(resource).location
if (!l?.latitude || !l?.longitude) {
Expand Down Expand Up @@ -153,7 +148,6 @@ export default defineComponent({
orientation,
takenDateTime,
location,
isLocationVisible,
isCopyToClipboardAvailable,
isCopiedToClipboard,
copyLocationToClipboardLabel,
Expand All @@ -167,14 +161,17 @@ export default defineComponent({
.exif-data-list {
display: grid;
grid-template-columns: auto minmax(0, 1fr);

dt,
dd {
margin-bottom: var(--oc-space-small);
}

dt {
font-weight: bold;
white-space: nowrap;
}

dd {
margin-inline-start: var(--oc-space-medium);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,38 +110,14 @@ describe('Exif SideBar Panel', () => {
const { wrapper } = createWrapper({ resource })
expect(wrapper.find(locationSelector).text()).toEqual('-')
})
it("doesn't show the location at all if forbidden in config", () => {
const resource = mock<Resource>({
location: mock<GeoCoordinates>({
latitude: 51.30044714422953,
longitude: 7.373170282627126
})
})
const { wrapper } = createWrapper({ resource, locationForbidden: true })
expect(wrapper.find(locationSelector).exists()).toBeFalsy()
})
})
})

function createWrapper({
resource,
locationForbidden
}: {
resource: Resource
locationForbidden?: boolean
}) {
function createWrapper({ resource }: { resource: Resource }) {
return {
wrapper: shallowMount(ExifPanel, {
global: {
plugins: [
...defaultPlugins({
piniaOptions: {
configState: {
options: { sidebar: { exif: { showLocation: locationForbidden !== true } } }
}
}
})
],
plugins: [...defaultPlugins({})],
provide: {
resource
}
Expand Down
3 changes: 0 additions & 3 deletions packages/web-pkg/src/composables/piniaStores/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ const defaultOptions = {
sidebar: {
shares: {
showAllOnLoad: false
},
exif: {
showLocation: true
}
},
tokenStorageLocal: true,
Expand Down
5 changes: 0 additions & 5 deletions packages/web-pkg/src/composables/piniaStores/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ const OptionsConfigSchema = z.object({
.object({
showAllOnLoad: z.boolean().optional()
})
.optional(),
exif: z
.object({
showLocation: z.boolean().optional()
})
.optional()
})
.optional(),
Expand Down