Parcourir la source

Add adaptive page icon for Firefox

Zen il y a 3 ans
Parent
commit
919aa1da9e
5 fichiers modifiés avec 34 ajouts et 0 suppressions
  1. 1 0
      package.json
  2. 10 0
      src/assets/svg/logoFirefox.svg
  3. 14 0
      src/newtab/App.vue
  4. 4 0
      src/newtab/index.js
  5. 5 0
      yarn.lock

+ 1 - 0
package.json

@@ -77,6 +77,7 @@
     "@intlify/vue-i18n-loader": "^4.2.0",
     "@tailwindcss/typography": "^0.5.1",
     "@vue/compiler-sfc": "^3.2.37",
+    "@vueuse/head": "^0.7.6",
     "archiver": "^5.3.0",
     "autoprefixer": "10.3.6",
     "babel-loader": "^8.2.2",

+ 10 - 0
src/assets/svg/logoFirefox.svg

@@ -0,0 +1,10 @@
+<svg width="600" height="600" viewBox="0 0 600 600" fill="none" xmlns="http://www.w3.org/2000/svg">
+	<rect x="53" y="58" width="452" height="452" rx="80" stroke="context-fill" stroke-width="30" stroke-linejoin="round"/>
+
+	<g fill-rule='evenodd' fill='context-fill'>
+		<path d="
+			M175 90h292A80 80 0 0 1 547 170v292A80 80 0 0 1 467 542h-292A80 80 0 0 1 95 462v-292A80 80 0 0 1 175 90M95 90M321 316
+			M293.667 220.666C304.723 198.554 336.277 198.554 347.333 220.666L432.308 390.616C444.814 415.628 419.067 443.212 392.87 433.428C363.012 422.277 332.936 412.348 320.5 412.348C308.064 412.348 277.988 422.277 248.13 433.428C221.933 443.212 196.186 415.628 208.692 390.616L293.667 220.666Z
+		" rx="80"/>
+	</g>
+</svg>

+ 14 - 0
src/newtab/App.vue

@@ -1,4 +1,8 @@
 <template>
+  <Head>
+    <link rel="icon" :href="icon" />
+  </Head>
+
   <template v-if="retrieved">
     <app-sidebar />
     <main class="pl-16">
@@ -80,6 +84,8 @@
   </ui-card>
 </template>
 <script setup>
+import iconFirefox from '@/assets/svg/logoFirefox.svg';
+import iconChrome from '@/assets/svg/logo.svg';
 import { ref, shallowReactive, computed } from 'vue';
 import { useStore } from 'vuex';
 import { useI18n } from 'vue-i18n';
@@ -94,6 +100,14 @@ import dayjs from '@/lib/dayjs';
 import Workflow from '@/models/workflow';
 import AppSidebar from '@/components/newtab/app/AppSidebar.vue';
 import dataMigration from '@/utils/dataMigration';
+import { Head } from '@vueuse/head';
+
+let icon;
+if (window.location.protocol === 'moz-extension:') {
+  icon = iconFirefox;
+} else {
+  icon = iconChrome;
+}
 
 const { t } = useI18n();
 const store = useStore();

+ 4 - 0
src/newtab/index.js

@@ -1,5 +1,6 @@
 import { createApp } from 'vue';
 import inspector from 'vue-inspector-agnostic';
+import { createHead } from '@vueuse/head';
 import App from './App.vue';
 import router from './router';
 import store from '../store';
@@ -11,8 +12,11 @@ import '../assets/css/tailwind.css';
 import '../assets/css/fonts.css';
 import '../assets/css/style.css';
 
+const head = createHead();
+
 createApp(App)
   .use(router)
+  .use(head)
   .use(store)
   .use(compsUi)
   .use(vueI18n)

+ 5 - 0
yarn.lock

@@ -1724,6 +1724,11 @@
   resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.37.tgz#8e6adc3f2759af52f0e85863dfb0b711ecc5c702"
   integrity sha512-4rSJemR2NQIo9Klm1vabqWjD8rs/ZaJSzMxkMNeJS6lHiUjjUeYFbooN19NgFjztubEKh3WlZUeOLVdbbUWHsw==
 
+"@vueuse/head@^0.7.6":
+  version "0.7.6"
+  resolved "https://registry.yarnpkg.com/@vueuse/head/-/head-0.7.6.tgz#39eb2aa593db6f02d10ba469b33d8cfbce038183"
+  integrity sha512-cOWqCkT3WiF5oEpw+VVEWUJd9RLD5rc7DmnFp3cePsejp+t7686uKD9Z9ZU7Twb7R/BI8iexKTmXo9D/F3v6UA==
+
 "@vueuse/rxjs@^8.6.0":
   version "8.6.0"
   resolved "https://registry.yarnpkg.com/@vueuse/rxjs/-/rxjs-8.6.0.tgz#0b6a41cfff1436cec8af068cb8fab4abe9d62c17"