Browse Source

feat: v1.0.0

Ahmad Kholid 3 years ago
parent
commit
5e30c53105

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "automa",
-  "version": "0.17.5",
+  "version": "1.0.0",
   "description": "An extension for automating your browser by connecting blocks",
   "license": "MIT",
   "repository": {

+ 6 - 1
src/components/newtab/workflow/WorkflowActions.vue

@@ -17,7 +17,12 @@
           <p>
             {{ t('workflow.host.set') }}
           </p>
-          <a :title="t('common.docs')" class="ml-1">
+          <a
+            :title="t('common.docs')"
+            href="https://docs.automa.site/guide/host-workflow.html"
+            target="_blank"
+            class="ml-1"
+          >
             <v-remixicon name="riInformationLine" size="20" />
           </a>
           <div class="flex-grow"></div>

+ 161 - 139
src/components/newtab/workflow/WorkflowShare.vue

@@ -1,152 +1,174 @@
 <template>
   <ui-card class="w-full max-w-2xl share-workflow overflow-auto scroll">
-    <div v-if="!isUpdate" class="flex items-center mb-4">
-      <p>{{ t('workflow.share.title') }}</p>
-      <div class="flex-grow"></div>
-      <ui-button class="mr-2" @click="$emit('close')">
-        {{ t('common.cancel') }}
-      </ui-button>
-      <ui-button
-        :loading="state.isPublishing"
-        variant="accent"
-        @click="publishWorkflow"
-      >
-        {{ t('workflow.share.publish') }}
-      </ui-button>
-    </div>
-    <slot name="prepend"></slot>
-    <div class="flex mb-4">
-      <input
-        v-model="state.workflow.name"
-        :placeholder="t('workflow.name')"
-        type="text"
-        name="workflow name"
-        class="font-semibold leading-none text-2xl focus:ring-0 block w-full bg-transparent mr-4 flex-1"
-      />
-      <ui-select v-model="state.workflow.category">
-        <option value="">{{ t('common.category') }} (none)</option>
-        <option
-          v-for="(category, id) in workflowCategories"
-          :key="id"
-          :value="id"
+    <template v-if="!store.state.user?.username">
+      <div class="flex items-center mb-12">
+        <p>{{ t('workflow.share.title') }}</p>
+        <div class="flex-grow"></div>
+        <button @click="$emit('close')">
+          <v-remixicon name="riCloseLine" />
+        </button>
+      </div>
+      <p class="text-center">
+        {{ t('auth.username') }}.
+        <a
+          class="underline"
+          href="https://automa.site/profile?username=true"
+          target="_blank"
         >
-          {{ category }}
-        </option>
-      </ui-select>
-    </div>
-    <div class="relative mb-2">
-      <ui-textarea
-        v-model="state.workflow.description"
-        :max="300"
-        placeholder="Short description"
-        class="w-full h-32 scroll resize-none"
-      />
-      <p
-        class="text-sm text-gray-600 dark:text-gray-200 absolute bottom-2 right-2"
-      >
-        {{ state.workflow.description.length }}/300
+          {{ t('auth.clickHere') }}
+        </a>
       </p>
-    </div>
-    <shared-wysiwyg
-      v-model="state.workflow.content"
-      :placeholder="t('common.description')"
-      :limit="5000"
-      class="prose prose-zinc dark:prose-invert max-w-none content-editor p-4 bg-box-transparent rounded-lg relative"
-      @count="state.contentLength = $event"
-    >
-      <template #prepend="{ editor }">
-        <div
-          class="p-2 rounded-lg backdrop-blur flex items-center sticky top-0 z-50 bg-box-transparent space-x-1 mb-2"
+    </template>
+    <template v-else>
+      <div v-if="!isUpdate" class="flex items-center mb-4">
+        <p>{{ t('workflow.share.title') }}</p>
+        <div class="flex-grow"></div>
+        <ui-button class="mr-2" @click="$emit('close')">
+          {{ t('common.cancel') }}
+        </ui-button>
+        <ui-button
+          :loading="state.isPublishing"
+          variant="accent"
+          @click="publishWorkflow"
         >
-          <button
-            :class="{
-              'bg-box-transparent text-primary': editor.isActive('heading', {
-                level: 1,
-              }),
-            }"
-            title="Heading 1"
-            class="editor-menu-btn hoverable"
-            @click="editor.commands.toggleHeading({ level: 1 })"
-          >
-            <v-remixicon name="riH1" />
-          </button>
-          <button
-            :class="{
-              'bg-box-transparent text-primary': editor.isActive('heading', {
-                level: 2,
-              }),
-            }"
-            title="Heading 2"
-            class="editor-menu-btn hoverable"
-            @click="editor.commands.toggleHeading({ level: 2 })"
-          >
-            <v-remixicon name="riH2" />
-          </button>
-          <span
-            class="w-px h-5 bg-gray-300 dark:bg-gray-600"
-            style="margin: 0 12px"
-          ></span>
-          <button
-            v-for="item in menuItems"
-            :key="item.id"
-            :title="item.name"
-            :class="{
-              'bg-box-transparent text-primary': editor.isActive(item.id),
-            }"
-            class="editor-menu-btn hoverable"
-            @click="editor.chain().focus()[item.action]().run()"
-          >
-            <v-remixicon :name="item.icon" />
-          </button>
-          <span
-            class="w-px h-5 bg-gray-300 dark:bg-gray-600"
-            style="margin: 0 12px"
-          ></span>
-          <button
-            :class="{
-              'bg-box-transparent text-primary': editor.isActive('blockquote'),
-            }"
-            title="Blockquote"
-            class="editor-menu-btn hoverable"
-            @click="editor.commands.toggleBlockquote()"
-          >
-            <v-remixicon name="riDoubleQuotesL" />
-          </button>
-          <button
-            title="Insert image"
-            class="editor-menu-btn hoverable"
-            @click="insertImage(editor)"
+          {{ t('workflow.share.publish') }}
+        </ui-button>
+      </div>
+      <slot name="prepend"></slot>
+      <div class="flex mb-4">
+        <input
+          v-model="state.workflow.name"
+          :placeholder="t('workflow.name')"
+          type="text"
+          name="workflow name"
+          class="font-semibold leading-none text-2xl focus:ring-0 block w-full bg-transparent mr-4 flex-1"
+        />
+        <ui-select v-model="state.workflow.category">
+          <option value="">{{ t('common.category') }} (none)</option>
+          <option
+            v-for="(category, id) in workflowCategories"
+            :key="id"
+            :value="id"
           >
-            <v-remixicon name="riImageLine" />
-          </button>
-          <button
-            :class="{
-              'bg-box-transparent text-primary': editor.isActive('link'),
-            }"
-            title="Link"
-            class="editor-menu-btn hoverable"
-            @click="setLink(editor)"
-          >
-            <v-remixicon name="riLinkM" />
-          </button>
-          <button
-            v-show="editor.isActive('link')"
-            title="Remove link"
-            class="editor-menu-btn hoverable"
-            @click="editor.commands.unsetLink()"
-          >
-            <v-remixicon name="riLinkUnlinkM" />
-          </button>
-        </div>
-      </template>
-      <template #append>
+            {{ category }}
+          </option>
+        </ui-select>
+      </div>
+      <div class="relative mb-2">
+        <ui-textarea
+          v-model="state.workflow.description"
+          :max="300"
+          placeholder="Short description"
+          class="w-full h-32 scroll resize-none"
+        />
         <p
           class="text-sm text-gray-600 dark:text-gray-200 absolute bottom-2 right-2"
         >
-          {{ state.contentLength }}/5000
+          {{ state.workflow.description.length }}/300
         </p>
-      </template>
-    </shared-wysiwyg>
+      </div>
+      <shared-wysiwyg
+        v-model="state.workflow.content"
+        :placeholder="t('common.description')"
+        :limit="5000"
+        class="prose prose-zinc dark:prose-invert max-w-none content-editor p-4 bg-box-transparent rounded-lg relative"
+        @count="state.contentLength = $event"
+      >
+        <template #prepend="{ editor }">
+          <div
+            class="p-2 rounded-lg backdrop-blur flex items-center sticky top-0 z-50 bg-box-transparent space-x-1 mb-2"
+          >
+            <button
+              :class="{
+                'bg-box-transparent text-primary': editor.isActive('heading', {
+                  level: 1,
+                }),
+              }"
+              title="Heading 1"
+              class="editor-menu-btn hoverable"
+              @click="editor.commands.toggleHeading({ level: 1 })"
+            >
+              <v-remixicon name="riH1" />
+            </button>
+            <button
+              :class="{
+                'bg-box-transparent text-primary': editor.isActive('heading', {
+                  level: 2,
+                }),
+              }"
+              title="Heading 2"
+              class="editor-menu-btn hoverable"
+              @click="editor.commands.toggleHeading({ level: 2 })"
+            >
+              <v-remixicon name="riH2" />
+            </button>
+            <span
+              class="w-px h-5 bg-gray-300 dark:bg-gray-600"
+              style="margin: 0 12px"
+            ></span>
+            <button
+              v-for="item in menuItems"
+              :key="item.id"
+              :title="item.name"
+              :class="{
+                'bg-box-transparent text-primary': editor.isActive(item.id),
+              }"
+              class="editor-menu-btn hoverable"
+              @click="editor.chain().focus()[item.action]().run()"
+            >
+              <v-remixicon :name="item.icon" />
+            </button>
+            <span
+              class="w-px h-5 bg-gray-300 dark:bg-gray-600"
+              style="margin: 0 12px"
+            ></span>
+            <button
+              :class="{
+                'bg-box-transparent text-primary':
+                  editor.isActive('blockquote'),
+              }"
+              title="Blockquote"
+              class="editor-menu-btn hoverable"
+              @click="editor.commands.toggleBlockquote()"
+            >
+              <v-remixicon name="riDoubleQuotesL" />
+            </button>
+            <button
+              title="Insert image"
+              class="editor-menu-btn hoverable"
+              @click="insertImage(editor)"
+            >
+              <v-remixicon name="riImageLine" />
+            </button>
+            <button
+              :class="{
+                'bg-box-transparent text-primary': editor.isActive('link'),
+              }"
+              title="Link"
+              class="editor-menu-btn hoverable"
+              @click="setLink(editor)"
+            >
+              <v-remixicon name="riLinkM" />
+            </button>
+            <button
+              v-show="editor.isActive('link')"
+              title="Remove link"
+              class="editor-menu-btn hoverable"
+              @click="editor.commands.unsetLink()"
+            >
+              <v-remixicon name="riLinkUnlinkM" />
+            </button>
+          </div>
+        </template>
+        <template #append>
+          <p
+            class="text-sm text-gray-600 dark:text-gray-200 absolute bottom-2 right-2"
+          >
+            {{ state.contentLength }}/5000
+          </p>
+        </template>
+      </shared-wysiwyg>
+    </template>
   </ui-card>
 </template>
 <script setup>

+ 4 - 0
src/lib/v-remixicon.js

@@ -3,6 +3,8 @@ import {
   riH1,
   riH2,
   riLinkM,
+  riTwitterLine,
+  riDiscordLine,
   riEarthLine,
   riClipboardLine,
   riLock2Line,
@@ -103,6 +105,8 @@ export const icons = {
   riH1,
   riH2,
   riLinkM,
+  riTwitterLine,
+  riDiscordLine,
   riEarthLine,
   riClipboardLine,
   riLock2Line,

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

@@ -14,6 +14,8 @@
   "auth": {
     "title": "Auth",
     "signIn": "Sign in",
+    "username": "You need to set your username first",
+    "clickHere": "Click here",
     "text": "You need to be signed in before you can do that"
   },
   "settings": {

+ 1 - 1
src/newtab/App.vue

@@ -115,7 +115,7 @@ async function fetchUserData() {
         'lastSync',
       ]);
 
-      if (username !== user.username) {
+      if (username !== user?.username) {
         await Workflow.update({
           where: ({ __id }) => __id !== null,
           data: { __id: null },

+ 29 - 0
src/newtab/pages/Welcome.vue

@@ -25,6 +25,17 @@
         <v-remixicon name="riCompass3Line" class="-ml-1 mr-2" />
         {{ t('welcome.marketplace') }}
       </ui-button>
+      <ui-button
+        v-for="link in links"
+        :key="link.name"
+        :href="link.url"
+        icon
+        tag="a"
+        target="_blank"
+        class="inline-block p-2 rounded-lg transition hoverable"
+      >
+        <v-remixicon :name="link.icon" />
+      </ui-button>
     </div>
   </div>
 </template>
@@ -32,4 +43,22 @@
 import { useI18n } from 'vue-i18n';
 
 const { t } = useI18n();
+
+const links = [
+  {
+    name: 'GitHub',
+    icon: 'riGithubFill',
+    url: 'https://github.com/kholid060/automa',
+  },
+  {
+    name: 'Twitter',
+    icon: 'riTwitterLine',
+    url: 'https://twitter.com/AutomaApp',
+  },
+  {
+    name: 'Discord',
+    icon: 'riDiscordLine',
+    url: 'https://discord.gg/C6khwwTE84',
+  },
+];
 </script>

+ 10 - 1
src/newtab/pages/settings/About.vue

@@ -20,7 +20,6 @@
         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 dark:border-gray-700 my-8"></div>
@@ -63,6 +62,16 @@ const links = [
     icon: 'riGithubFill',
     url: 'https://github.com/kholid060/automa',
   },
+  {
+    name: 'Twitter',
+    icon: 'riTwitterLine',
+    url: 'https://twitter.com/AutomaApp',
+  },
+  {
+    name: 'Discord',
+    icon: 'riDiscordLine',
+    url: 'https://discord.gg/C6khwwTE84',
+  },
   { name: 'Website', icon: 'riGlobalLine', url: 'https://www.automa.site' },
   {
     name: 'Documentation',

+ 3 - 1
src/newtab/pages/workflows/Host.vue

@@ -180,7 +180,7 @@ function syncWorkflow() {
   state.loadingSync = true;
   const hostId = {
     hostId: workflow.value.hostId,
-    updatedAt: workflow.value.updatedAt,
+    updatedAt: null,
   };
 
   store
@@ -189,6 +189,8 @@ function syncWorkflow() {
       if (!workflow.value) {
         router.replace('/workflows');
       }
+      /* eslint-disable-next-line */
+      retrieveTriggerText();
       state.loadingSync = false;
     })
     .catch((error) => {

+ 11 - 0
src/newtab/pages/workflows/[id].vue

@@ -194,6 +194,15 @@
   >
     <template v-if="workflowModal.title" #header>
       {{ workflowModal.title }}
+      <a
+        v-if="workflowModal.docs"
+        :title="t('common.docs')"
+        :href="workflowModal.docs"
+        target="_blank"
+        class="inline-block align-middle"
+      >
+        <v-remixicon name="riInformationLine" size="20" />
+      </a>
     </template>
     <component
       :is="workflowModal.component"
@@ -332,6 +341,7 @@ const workflowModals = {
     icon: 'riKey2Line',
     component: WorkflowDataTable,
     title: t('workflow.table.title'),
+    docs: 'https://docs.automa.site/api-reference/table.html',
   },
   'workflow-share': {
     icon: 'riShareLine',
@@ -359,6 +369,7 @@ const workflowModals = {
     icon: 'riDatabase2Line',
     component: WorkflowGlobalData,
     title: t('common.globalData'),
+    docs: 'https://docs.automa.site/api-reference/global-data.html',
   },
   settings: {
     icon: 'riSettings3Line',

+ 1 - 1
src/popup/pages/Home.vue

@@ -180,7 +180,7 @@ function recordWorkflow() {
         },
       });
       await browser.browserAction.setBadgeBackgroundColor({ color: '#ef4444' });
-      await browser.browserAction.setBadgeText({ text: ' ' });
+      await browser.browserAction.setBadgeText({ text: 'rec' });
 
       const tabs = (await browser.tabs.query({})).filter(({ url }) =>
         url.startsWith('http')

+ 1 - 1
src/utils/workflow-trigger.js

@@ -100,7 +100,7 @@ export function registerSpecificDate(workflowId, data) {
 
   if (data.date) {
     const [hour, minute] = data.time.split(':');
-    date = dayjs(data.data).hour(hour).minute(minute).valueOf();
+    date = dayjs(data.data).hour(hour).minute(minute).second(0).valueOf();
   }
 
   return browser.alarms.create(workflowId, {