Skip to content

Commit

Permalink
deps: pinia-plugin-persistedstate
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanimodori committed Feb 22, 2024
1 parent a35e5cd commit 7899f40
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 39 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"echarts": "^5.5.0",
"electron-updater": "6.1.7",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"uuid": "^9.0.1",
"vue-echarts": "^6.6.9",
"vue-i18n": "^9.9.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/renderer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { createApp } from 'vue';
import { ConfigProvider, App as AppComponent, Layout, Menu, Button, Tabs, Table } from 'ant-design-vue';
import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import App from '@/App.vue';
import router from '@/router';
import i18n from './locales';

const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
const app = createApp(App);

app.use(pinia);
Expand Down
86 changes: 47 additions & 39 deletions packages/renderer/src/store/settings.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';

export const useSettingsStore = defineStore('settings', () => {
const connection = ref({
host: 'localhost',
port: 24399,
startup: true,
retry: true,
});
export const useSettingsStore = defineStore(
'settings',
() => {
const connection = ref({
host: 'localhost',
port: 24399,
startup: true,
retry: true,
});

const damageStyle = ref({
bgAlpha: 100,
bgColor: 'FFFFFF',
bgCornerSize: 0,
fontAlpha: 100,
fontColor: '000000',
fontSize: 16,
});
const damageStyle = ref({
bgAlpha: 100,
bgColor: 'FFFFFF',
bgCornerSize: 0,
fontAlpha: 100,
fontColor: 'FFFFFF',
fontSize: 16,
fontBorderCol: '000000',
fontBorderSize: 0,
});

const damageCols = ref({
order: [],
});
const damageCols = ref({
order: [],
});

const windowStyle = ref({
align: 'topleft',
paddingtop: 0,
paddingbottom: 0,
paddingleft: 0,
paddingright: 0,
width: 700,
height: 500,
});
const windowStyle = ref({
x: 0,
y: 0,
width: 700,
height: 500,
});

const shortcut = ref({
enabled: true,
key: 'Ctrl+Shift+Num0',
});
const shortcut = ref({
enabled: true,
key: 'Ctrl+Shift+Num0',
});

return {
connection,
damageStyle,
damageCols,
windowStyle,
shortcut,
};
});
return {
connection,
damageStyle,
damageCols,
windowStyle,
shortcut,
};
},
{
persist: {
key: 'record',
storage: localStorage,
},
},
);
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7899f40

Please sign in to comment.