Skip to content

Commit b8eddec

Browse files
committed
feat: Add permission reload modal for Firefox and update localization strings
1 parent bf8b882 commit b8eddec

File tree

15 files changed

+150
-13
lines changed

15 files changed

+150
-13
lines changed

entrypoints/sidepanel/components/Chat/CameraButton.vue

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
<template>
2-
<button
3-
v-if="showButton"
4-
:class="classNames(
5-
'size-6 rounded-md flex items-center justify-center transition-colors',
6-
isCapturing
7-
? 'cursor-wait opacity-50'
8-
: 'hover:bg-bg-tertiary cursor-pointer'
9-
)"
10-
:disabled="isCapturing"
11-
@click="handleCapture"
12-
>
13-
<IconCamera :class="classNames('size-6', hasCapturedPage ? 'text-accent-primary' : 'text-text-tertiary')" />
14-
</button>
2+
<div>
3+
<button
4+
v-if="showButton"
5+
:class="classNames(
6+
'size-6 rounded-md flex items-center justify-center transition-colors',
7+
isCapturing
8+
? 'cursor-wait opacity-50'
9+
: 'hover:bg-bg-tertiary cursor-pointer'
10+
)"
11+
:disabled="isCapturing"
12+
@click="handleCapture"
13+
>
14+
<IconCamera :class="classNames('size-6', hasCapturedPage ? 'text-accent-primary' : 'text-text-tertiary')" />
15+
</button>
16+
17+
<!-- Permission Reload Modal for Firefox -->
18+
<Modal v-model="isShowPermissionReloadModal">
19+
<PermissionReloadModal @close="isShowPermissionReloadModal = false" />
20+
</Modal>
21+
</div>
1522
</template>
1623

1724
<script setup lang="ts">
1825
import { computed, ref, watch } from 'vue'
1926
import { browser } from 'wxt/browser'
2027
2128
import IconCamera from '@/assets/icons/camera.svg?component'
29+
import Modal from '@/components/Modal.vue'
2230
import { CapturedPageAttachment, ContextAttachmentStorage } from '@/types/chat'
2331
import { useI18n } from '@/utils/i18n'
2432
import { generateRandomId } from '@/utils/id'
@@ -30,6 +38,7 @@ import { getUserConfig } from '@/utils/user-config'
3038
import { classNames } from '@/utils/vue/utils'
3139
3240
import type AttachmentSelector from '../AttachmentSelector.vue'
41+
import PermissionReloadModal from './PermissionReloadModal.vue'
3342
3443
const props = defineProps<{
3544
attachmentSelectorRef?: InstanceType<typeof AttachmentSelector>
@@ -41,6 +50,8 @@ const { t } = useI18n()
4150
4251
const isCapturing = ref(false)
4352
const supportsVision = ref(false)
53+
const isFirefox = import.meta.env.FIREFOX
54+
const isShowPermissionReloadModal = ref(false)
4455
4556
// Maximum number of images and screenshots allowed combined
4657
const MAX_IMAGE_COUNT = 5
@@ -121,6 +132,9 @@ const handleCapture = async () => {
121132
}
122133
catch (error) {
123134
logger.error('Failed to capture screenshot:', error)
135+
if (isFirefox) {
136+
isShowPermissionReloadModal.value = true
137+
}
124138
}
125139
finally {
126140
isCapturing.value = false
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="bg-bg-primary text-text-primary py-6 px-6 rounded-md max-w-sm flex flex-col gap-4">
3+
<!-- Title -->
4+
<div class="font-bold text-base flex flex-row gap-2 items-center">
5+
<IconCamera class="size-4 text-accent-primary" />
6+
{{ t('chat.camera.permission_reload_title') }}
7+
</div>
8+
9+
<!-- Description -->
10+
<div class="text-text-secondary text-sm">
11+
{{ t('chat.camera.permission_reload_description') }}
12+
</div>
13+
14+
<!-- Divider -->
15+
<Divider class="my-2" />
16+
17+
<!-- Buttons -->
18+
<div class="flex gap-2 items-center justify-end">
19+
<Button
20+
variant="secondary"
21+
class="p-2"
22+
@click="handleClose"
23+
>
24+
{{ t('tooltips.close') }}
25+
</Button>
26+
<Button
27+
variant="primary"
28+
class="p-2"
29+
@click="handleReload"
30+
>
31+
{{ t('chat.camera.reload_extension') }}
32+
</Button>
33+
</div>
34+
</div>
35+
</template>
36+
37+
<script setup lang="ts">
38+
import { browser } from 'wxt/browser'
39+
40+
import IconCamera from '@/assets/icons/camera.svg?component'
41+
import Button from '@/components/ui/Button.vue'
42+
import Divider from '@/components/ui/Divider.vue'
43+
import { useI18n } from '@/utils/i18n'
44+
45+
const emit = defineEmits<{
46+
(e: 'close'): void
47+
}>()
48+
49+
const { t } = useI18n()
50+
51+
const handleClose = () => {
52+
emit('close')
53+
}
54+
55+
const handleReload = () => {
56+
browser.runtime.reload()
57+
}
58+
</script>

locales/de.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "Suchen"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "Neustart erforderlich",
94+
"permission_reload_description": "Nach der Genehmigung aktivieren Sie bitte die NativeMind-Erweiterung in Firefox erneut, um die Screenshot-Funktion zu aktivieren.",
95+
"reload_extension": "Erweiterung neu laden"
9196
}
9297
},
9398
"chat_history": {

locales/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@
277277
"captured_page_prefix": "Page Captured:"
278278
}
279279
},
280+
"camera": {
281+
"permission_reload_title": "Reload Required",
282+
"permission_reload_description": "After granting permission, please re-enable the NativeMind extension in Firefox to enable the screenshot feature.",
283+
"reload_extension": "Reload Extension"
284+
},
280285
"prompt": {
281286
"summarize_page_content": {
282287
"title": "Summarize the page"

locales/es.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "Buscar"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "Recarga requerida",
94+
"permission_reload_description": "Después de otorgar el permiso, vuelva a habilitar la extensión NativeMind en Firefox para habilitar la función de captura de pantalla.",
95+
"reload_extension": "Recargar extensión"
9196
}
9297
},
9398
"chat_history": {

locales/fr.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "Recherche"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "Rechargement requis",
94+
"permission_reload_description": "Après avoir accordé la permission, veuillez réactiver l'extension NativeMind dans Firefox pour activer la fonction de capture d'écran.",
95+
"reload_extension": "Recharger l'extension"
9196
}
9297
},
9398
"chat_history": {

locales/id.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "Cari"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "Muat ulang diperlukan",
94+
"permission_reload_description": "Setelah memberikan izin, silakan aktifkan kembali ekstensi NativeMind di Firefox untuk mengaktifkan fitur tangkapan layar.",
95+
"reload_extension": "Muat ulang ekstensi"
9196
}
9297
},
9398
"chat_history": {

locales/ja.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "検索"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "再読み込みが必要です",
94+
"permission_reload_description": "権限を付与した後、スクリーンショット機能を有効にするためにFirefoxでNativeMind拡張機能を再度有効にしてください。",
95+
"reload_extension": "拡張機能を再読み込み"
9196
}
9297
},
9398
"chat_history": {

locales/ko.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "검색"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "다시 로드 필요",
94+
"permission_reload_description": "권한을 부여한 후 Firefox에서 NativeMind 확장 프로그램을 다시 활성화하여 스크린샷 기능을 활성화하세요.",
95+
"reload_extension": "확장 프로그램 다시 로드"
9196
}
9297
},
9398
"chat_history": {

locales/pt.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"online_search": {
8989
"title": "Pesquisar"
9090
}
91+
},
92+
"camera": {
93+
"permission_reload_title": "Recarga necessária",
94+
"permission_reload_description": "Após conceder permissão, reative a extensão NativeMind no Firefox para ativar a função de captura de tela.",
95+
"reload_extension": "Recarregar extensão"
9196
}
9297
},
9398
"chat_history": {

0 commit comments

Comments
 (0)