Skip to content

Commit

Permalink
[native] feat: warn user if URL is already bookmarked
Browse files Browse the repository at this point in the history
fixes #1278

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jul 21, 2024
1 parent cb0ca2c commit 596a4fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -767,5 +767,8 @@
},
"DescriptionDisabledaftererror": {
"message": "Retried 10 times before disabling this profile"
},
"DescriptionBookmarkexists": {
"message": "This bookmark exists already in the selected profile"
}
}
29 changes: 21 additions & 8 deletions src/ui/views/native/AddBookmarkIntent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
<v-app-bar
absolute
app>
<v-btn
icon
:to="{name: routes.TREE, params: {accountId: id}}">
<v-icon>mdi-arrow-left</v-icon>
</v-btn>
<v-app-bar-title>Add Bookmark</v-app-bar-title>
<v-spacer />
<v-btn
Expand All @@ -24,7 +19,9 @@
indeterminate
color="blue darken-1"
class="loading" />
<v-card v-else>
<v-card
v-else
style="min-height: 95vh">
<v-card-text>
<v-select
dense
Expand All @@ -40,6 +37,15 @@
<v-icon>{{ item.data.type | accountIcon }}</v-icon> {{ item.label }}
</template>
</v-select>
<v-alert
v-if="exists"
dense
outlined
text
type="info"
class="mb-2">
{{ t('DescriptionBookmarkexists') }}
</v-alert>
<v-text-field
v-model="title"
label="Title"
Expand Down Expand Up @@ -75,7 +81,7 @@
<script>
import { routes } from '../../NativeRouter'
import { actions } from '../../store/definitions'
import { Bookmark } from '../../../lib/Tree'
import { Bookmark, ItemType } from '../../../lib/Tree'
import DialogChooseFolder from '../../components/native/DialogChooseFolder'
import { SendIntent } from 'send-intent'
Expand All @@ -87,7 +93,8 @@ export default {
const icons = {
'google-drive': 'mdi-google-drive',
'nextcloud-bookmarks': 'mdi-cloud',
'webdav': 'mdi-folder-network'
'webdav': 'mdi-folder-network',
'git': 'mdi-source-repository',
}
return icons[type]
},
Expand Down Expand Up @@ -129,13 +136,19 @@ export default {
}
const folder = this.tree.findFolder(this.temporaryParent)
return folder ? folder.title || this.t('LabelUntitledfolder') : ''
},
exists() {
return !this.loading && this.tree && this.tree.findItemFilter(ItemType.BOOKMARK, (bm) => bm.url === this.url)
}
},
watch: {
loading() {
if (this.loading) return
this.data = this.$store.state.accounts[this.id].data
},
id() {
this.$store.dispatch(actions.LOAD_TREE, this.id)
},
url() {
this.urlError = null
try {
Expand Down

0 comments on commit 596a4fd

Please sign in to comment.