Skip to content

Commit f2069c4

Browse files
committed
Make setup simple
1 parent 8f281cd commit f2069c4

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

views/Settings.vue

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
2-
import {computed, ref} from "vue";
3-
import {useQuery} from "@tanstack/vue-query";
4-
import {getTaskStatuses} from "@/api";
5-
import {capitalizeFirstLetter} from "../helpers";
2+
import {computed, ref} from 'vue'
3+
import {useQuery} from '@tanstack/vue-query'
4+
import {getTaskStatuses} from '@/api'
5+
import {capitalizeFirstLetter} from '../helpers'
66
77
const invoiceNinjaURL = ref(localStorage.getItem('invoiceNinjaURL') || 'https://invoicing.co/api/v1')
88
const invoiceNinjaAPIToken = ref(localStorage.getItem('invoiceNinjaAPIToken') || '')
@@ -23,7 +23,11 @@ const saveStatuses = () => {
2323
const {statuses, isComplete} = useSettings()
2424
2525
const enabled = computed(() => !!(localStorage.getItem('invoiceNinjaAPIToken') && localStorage.getItem('invoiceNinjaURL')))
26-
const {data: options, isPending, isError} = useQuery({
26+
const {
27+
data: options,
28+
isPending,
29+
isError
30+
} = useQuery({
2731
enabled,
2832
queryKey: ['task-statuses'],
2933
queryFn: getTaskStatuses
@@ -38,24 +42,27 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
3842
<div class="container">
3943
<h2>{{ isComplete ? 'Settings' : 'Setup' }}</h2>
4044
<form class="connect-invoice-ninja" @submit.prevent="saveAPI">
41-
<h3 for="token">1. Connect to Invoice Ninja</h3>
42-
<label for="token">API Token (get from <a
43-
href="https://app.invoicing.co/#/settings/task_settings">settings</a> invoice ninja)</label>
45+
<h3 for="token">
46+
1. Get token from
47+
<a href="https://app.invoicing.co/?#/settings/integrations/api_tokens/create">Invoice Ninja</a>
48+
</h3>
4449

45-
<input v-model="invoiceNinjaAPIToken" placeholder="Example: bXlfbXlfbXlfbXlfbXlfbXlfbXlfbXlf" required
46-
type="text"/>
50+
<input v-model="invoiceNinjaAPIToken" placeholder="xxxxxxxxxxxxxx" required type="text" />
4751
<details class="extends-settings">
48-
<summary>Extend settings</summary>
52+
<summary class="extends-settings-button">Extend settings</summary>
4953
<label for="url">Invoice Ninja API URL (optional)</label>
50-
<input v-model="invoiceNinjaURL" placeholder="Example: https://invoicing.co/api/v1" type="text"/>
54+
<input v-model="invoiceNinjaURL" placeholder="Example: https://invoicing.co/api/v1" type="text" />
5155
</details>
5256
<button type="submit">Save</button>
5357
</form>
5458
<Transition mode="out-in">
5559
<form v-if="enabled" class="select-statuses" @submit.prevent="saveStatuses">
56-
<h3>2. Select statuses for task</h3>
57-
<template v-for="(value, key) in statuses"
58-
style="width: 100%; display: flex; align-items: start; flex-direction: column; gap: 0.5em">
60+
<h3>
61+
2. Select
62+
<a href="https://app.invoicing.co/?#/settings/task_settings">statuses</a>
63+
for task
64+
</h3>
65+
<template v-for="(value, key) in statuses" style="width: 100%; display: flex; align-items: start; flex-direction: column; gap: 0.5em">
5966
<label :for="value || key">{{ capitalizeFirstLetter(key) }} status</label>
6067
<template v-if="isError">
6168
<select :id="value || key" disabled required>
@@ -69,10 +76,11 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
6976
</template>
7077

7178
<template v-else>
72-
<select :id="value || key" :value="value" required
73-
@change="updateStatus($event.target.value, key)">
79+
<select :id="value || key" :value="value" required @change="updateStatus($event.target.value, key)">
7480
<option disabled selected value="">Please select one</option>
75-
<option v-for="{id, name} in options.data" :value="id">{{ name }}</option>
81+
<option v-for="{id, name} in options.data" :value="id">
82+
{{ name }}
83+
</option>
7684
</select>
7785
</template>
7886
</template>
@@ -97,7 +105,7 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
97105
flex-direction: column;
98106
gap: 0.5em;
99107
width: 20em;
100-
margin-bottom: 3em
108+
margin-bottom: 3em;
101109
}
102110
103111
.select-statuses {
@@ -108,12 +116,22 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
108116
}
109117
110118
button {
111-
margin-top: 1em
119+
margin-top: 1em;
112120
}
113121
114122
.extends-settings {
115123
width: 100%;
116124
text-align: start;
117125
margin: 1em 0;
118126
}
127+
128+
.extends-settings-button {
129+
filter: brightness(0.5);
130+
color: ghostwhite;
131+
margin-bottom: 1em;
132+
}
133+
134+
.extends-settings-button::marker {
135+
content: '';
136+
}
119137
</style>

0 commit comments

Comments
 (0)