blob: 0553e416caf0cfcfd8e4360eb2cf1f90f27896eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<!--
- SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import { mdiMagnifyClose } from '@mdi/js'
import { t } from '@nextcloud/l10n'
import debounce from 'debounce'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import NcInputField from '@nextcloud/vue/components/NcInputField'
import { getPinia } from '../store/index.ts'
import { useSearchStore } from '../store/search.ts'
const searchStore = useSearchStore(getPinia())
const debouncedUpdate = debounce((value: string) => {
searchStore.query = value
}, 500)
</script>
<template>
<NcEmptyContent :name="t('files', 'No search results for “{query}”', { query: searchStore.query })">
<template #icon>
<NcIconSvgWrapper :path="mdiMagnifyClose" />
</template>
<template #action>
<div class="search-empty-view__wrapper">
<NcInputField class="search-empty-view__input"
:label="t('files', 'Search for files')"
:model-value="searchStore.query"
type="search"
@update:model-value="debouncedUpdate" />
<NcButton v-if="searchStore.scope === 'locally'" @click="searchStore.scope = 'globally'">
{{ t('files', 'Search globally') }}
</NcButton>
</div>
</template>
</NcEmptyContent>
</template>
<style scoped lang="scss">
.search-empty-view {
&__input {
flex: 0 1;
min-width: min(400px, 50vw);
}
&__wrapper {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: baseline;
}
}
</style>
|