Selaa lähdekoodia

feat: add about page

Ahmad Kholid 3 vuotta sitten
vanhempi
commit
61ea8cba0c

+ 9 - 36
src/components/newtab/app/AppSidebar.vue

@@ -2,7 +2,11 @@
   <aside
     class="fixed flex flex-col items-center h-screen left-0 top-0 w-16 py-6 bg-white z-50"
   >
-    <img src="@/assets/svg/logo.svg" class="w-10 mb-4 mx-auto" />
+    <img
+      :title="`v${extensionVersion}`"
+      src="@/assets/svg/logo.svg"
+      class="w-10 mb-4 mx-auto"
+    />
     <div
       class="space-y-2 w-full relative text-center"
       @mouseleave="showHoverIndicator = false"
@@ -37,24 +41,9 @@
       </router-link>
     </div>
     <div class="flex-grow"></div>
-    <ui-popover placement="right" trigger="mouseenter click">
-      <template #trigger>
-        <v-remixicon class="cursor-pointer" name="riInformationLine" />
-      </template>
-      <ui-list class="space-y-1">
-        <ui-list-item
-          v-for="item in links"
-          :key="item.name"
-          :href="item.url"
-          tag="a"
-          rel="noopener"
-          target="_blank"
-        >
-          <v-remixicon :name="item.icon" class="-ml-1 mr-2" />
-          <span>{{ item.name }}</span>
-        </ui-list-item>
-      </ui-list>
-    </ui-popover>
+    <router-link v-tooltip:right.group="t('settings.menu.about')" to="/about">
+      <v-remixicon class="cursor-pointer" name="riInformationLine" />
+    </router-link>
   </aside>
 </template>
 <script setup>
@@ -68,23 +57,7 @@ useGroupTooltip();
 const { t } = useI18n();
 const router = useRouter();
 
-const links = [
-  {
-    name: 'Donate',
-    icon: 'riHandHeartLine',
-    url: 'https://paypal.me/akholid060',
-  },
-  {
-    name: t('common.docs', 2),
-    icon: 'riBook3Line',
-    url: 'https://docs.automa.site',
-  },
-  {
-    name: 'GitHub',
-    icon: 'riGithubFill',
-    url: 'https://github.com/kholid060/automa',
-  },
-];
+const extensionVersion = chrome.runtime.getManifest().version;
 const tabs = [
   {
     id: 'dashboard',

+ 2 - 1
src/locales/en/newtab.json

@@ -18,7 +18,8 @@
       "reloadPage": "Reload the page to take effect"
     },
     "menu": {
-      "general": "General"
+      "general": "General",
+      "about": "About"
     },
   },
   "workflow": {

+ 6 - 3
src/newtab/pages/Settings.vue

@@ -6,14 +6,14 @@
         <router-link
           v-for="menu in menus"
           :key="menu.id"
-          v-slot="{ href, navigate, isActive }"
+          v-slot="{ href, navigate, isExactActive }"
           custom
           :to="menu.path"
         >
           <ui-list-item
             :href="href"
             :class="[
-              isActive
+              isExactActive
                 ? 'bg-box-transparent'
                 : 'text-gray-600 dark:text-gray-600',
             ]"
@@ -36,5 +36,8 @@ import { useI18n } from 'vue-i18n';
 
 const { t } = useI18n();
 
-const menus = [{ id: 'general', path: '/settings', icon: 'riSettings3Line' }];
+const menus = [
+  { id: 'general', path: '/settings', icon: 'riSettings3Line' },
+  { id: 'about', path: '/about', icon: 'riInformationLine' },
+];
 </script>

+ 109 - 0
src/newtab/pages/settings/About.vue

@@ -0,0 +1,109 @@
+<template>
+  <div class="max-w-lg">
+    <div class="p-3 mb-2 bg-box-transparent rounded-full inline-block">
+      <img src="@/assets/svg/logo.svg" class="w-14" />
+    </div>
+    <p class="text-2xl font-semibold">Automa</p>
+    <p class="mb-2 mt-1">Version: {{ extensionVersion }}</p>
+    <p class="text-gray-600">
+      Automa is a chrome extension for browser automation. From auto-fill forms,
+      doing a repetitive task, taking a screenshot, to scraping data of the
+      website, it's up to you what you want to do with this extension.
+    </p>
+    <div class="mt-4 space-x-2">
+      <a
+        v-for="link in links"
+        :key="link.name"
+        v-tooltip.group="link.name"
+        :href="link.url"
+        target="_blank"
+        class="inline-block p-2 rounded-lg transition hoverable"
+      >
+        <v-remixicon :name="link.icon" />
+        <p class="ml-1 hidden">{{ link.name }}</p>
+      </a>
+    </div>
+    <div class="border-b my-8"></div>
+    <h2 class="text-xl font-semibold">Contributors</h2>
+    <p class="mt-1 text-gray-600">
+      Thanks to everyone who has submitted issues, made suggestions, and
+      generally helped make this a better project.
+    </p>
+    <div class="mt-4 gap-2 mb-12 grid grid-cols-7">
+      <a
+        v-for="contributor in store.state.contributors"
+        :key="contributor.username"
+        v-tooltip.group="contributor.username"
+        :href="contributor.url"
+        target="_blank"
+        rel="noopener"
+      >
+        <img
+          :src="contributor.avatar"
+          :alt="`${contributor.username} avatar`"
+          class="w-16 rounded-lg"
+        />
+      </a>
+    </div>
+  </div>
+</template>
+<script setup>
+/* eslint-disable camelcase */
+import { onMounted } from 'vue';
+import { useStore } from 'vuex';
+import { useGroupTooltip } from '@/composable/groupTooltip';
+
+useGroupTooltip();
+const store = useStore();
+
+const extensionVersion = chrome.runtime.getManifest().version;
+const links = [
+  {
+    name: 'GitHub',
+    icon: 'riGithubFill',
+    url: 'https://github.com/kholid060/automa',
+  },
+  { name: 'Website', icon: 'riGlobalLine', url: 'https://www.automa.site' },
+  {
+    name: 'Documentation',
+    icon: 'riBook3Line',
+    url: 'https://docs.automa.site',
+  },
+  {
+    name: 'Donate',
+    icon: 'riHandHeartLine',
+    url: 'https://paypal.me/akholid060',
+  },
+];
+
+onMounted(async () => {
+  if (store.contributors) return;
+
+  try {
+    const response = await fetch(
+      'https://api.github.com/repos/Kholid060/automa/contributors'
+    );
+    const contributors = (await response.json()).reduce(
+      (acc, { type, avatar_url, login, html_url }) => {
+        if (type !== 'Bot') {
+          acc.push({
+            username: login,
+            url: html_url,
+            avatar: avatar_url,
+          });
+        }
+
+        return acc;
+      },
+      []
+    );
+
+    store.commit('updateState', {
+      key: 'contributors',
+      value: contributors,
+    });
+  } catch (error) {
+    console.error(error);
+  }
+});
+</script>

+ 5 - 1
src/newtab/router.js

@@ -9,6 +9,7 @@ import Logs from './pages/Logs.vue';
 import LogsDetails from './pages/logs/[id].vue';
 import Settings from './pages/Settings.vue';
 import SettingsIndex from './pages/settings/index.vue';
+import SettingsAbout from './pages/settings/About.vue';
 
 const routes = [
   {
@@ -54,7 +55,10 @@ const routes = [
   {
     path: '/settings',
     component: Settings,
-    children: [{ path: '', component: SettingsIndex }],
+    children: [
+      { path: '', component: SettingsIndex },
+      { path: '/about', component: SettingsAbout },
+    ],
   },
 ];
 

+ 1 - 0
src/store/index.js

@@ -7,6 +7,7 @@ import { firstWorkflows } from '@/utils/shared';
 const store = createStore({
   plugins: [vuexORM(models)],
   state: () => ({
+    contributors: null,
     workflowState: [],
     settings: {
       locale: 'en',