Skip to content

Commit

Permalink
#56 add: option viewing
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Jan 30, 2024
1 parent 5c94227 commit b3f5f99
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/layouts/OptionsLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<q-layout view="lHh Lpr lFf">
<q-page-container>
<router-view />
</q-page-container>
</q-layout>
</template>
68 changes: 66 additions & 2 deletions src/pages/OptionsPage.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,71 @@
<template>
<q-page class="flex flex-center">
Options
<q-card>
<q-card-section>
<div class="text-h6">{{ getLocale('settingsHeadline') }}</div>
</q-card-section>
<q-card-section>
<q-form class="q-gutter-md">
<q-input
filled
type="number"
v-model="socketPort"
:label="getLocale('socketPortLabel')"
/>
<q-input
filled
:type="isPwd ? 'password' : 'text'"
v-model="token"
:label="getLocale('Token')"
:hint="getLocale('TokenHint')"
hide-bottom-space
>
<template v-slot:append>
<q-icon
:name="isPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="isPwd = !isPwd"
/>
</template>
</q-input>
</q-form>
</q-card-section>
</q-card>
</q-page>
</template>
<script setup>
<script>
import {getLocale} from "src/helpers/utils";
import {defineComponent, onMounted, ref} from "vue";
export default defineComponent({
methods: {getLocale},
setup () {
let socketPort = ref(22222);
let token = ref('');
const isPwd = ref(true);
const loadSettings = () => {
// Load settings
chrome.storage.sync.get(function (data) {
const port = data.socketPort;
if (port !== null && !isNaN(port)) {
socketPort.value = parseInt(port);
}
token.value = data.token;
});
}
onMounted(() => {
loadSettings();
});
return {
token,
isPwd,
socketPort,
}
}
});
</script>
4 changes: 1 addition & 3 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ const routes = [
},
{
path: '/options',
component: () => import('layouts/MainLayout.vue'),
component: () => import('layouts/OptionsLayout.vue'),
children: [
{ path: '', component: () => import('pages/OptionsPage.vue') }
]
},

// { path: '/options', component: () => import('pages/OptionsPage.vue') },

// Always leave this as last one,
// but you can also remove it
{
Expand Down

0 comments on commit b3f5f99

Please sign in to comment.