Skip to content

Commit

Permalink
refactor: move style files to "styles" folder
Browse files Browse the repository at this point in the history
fix: adjust light/dark theme in windows
  • Loading branch information
tiny-craft committed Aug 2, 2023
1 parent 7eebb02 commit 5750170
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Tiny RDM is a modern lightweight cross-platform Redis desktop manager available
![](screenshots/light_en.png)

## Feature
* Built on Webview, no embedded browsers (Thanks to Wails).
* More elegant UI and visualized layout (Thanks to Naive UI).
* Built on Webview, no embedded browsers (Thanks to [Wails](https://github.com/wailsapp/wails)).
* More elegant UI and visualized layout (Thanks to [Naive UI](https://github.com/tusen-ai/naive-ui)).
* Multi-language support (Click here to contribute and support more languages).
* Convenient data viewing and editing.
* More features under continuous development...
Expand Down
4 changes: 2 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Tiny RDM是一个现代化轻量级的跨平台Redis桌面客户端,支持Mac

## 功能特性

* 基于Webview,无内嵌浏览器(感谢Wails
* 更精美的界面和直观的结构布局(感谢Naive UI)
* 基于Webview,无内嵌浏览器(感谢[Wails](https://github.com/wailsapp/wails)
* 更精美的界面和直观的结构布局(感谢[Naive UI](https://github.com/tusen-ai/naive-ui)
* 多国语言支持(点我贡献和完善多国语言支持)
* 便捷的数据查看和编辑修改
* 更多功能持续开发中…
Expand Down
2 changes: 1 addition & 1 deletion backend/storage/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func NewPreferences() *PreferencesStorage {
func (p *PreferencesStorage) DefaultPreferences() map[string]any {
return map[string]any{
"general": map[string]any{
"language": "en",
"language": "auto",
"font": "",
"font_size": 14,
"use_sys_proxy": false,
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset='UTF-8' />
<meta content='width=device-width, initial-scale=1.0' name='viewport' />
<title>Tiny RDM</title>
<!-- <link href="./src/style.scss" rel="stylesheet">-->
<!-- <link href="./src/styles/style.scss" rel="stylesheet">-->
</head>
<body>
<div id='app'></div>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import useConnectionStore from './stores/connections.js'
import { useI18n } from 'vue-i18n'
import { darkTheme, lightTheme, useOsTheme } from 'naive-ui'
import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue'
import { WindowSetDarkTheme, WindowSetLightTheme } from '../wailsjs/runtime/runtime.js'
hljs.registerLanguage('json', json)
hljs.registerLanguage('plaintext', plaintext)
Expand Down Expand Up @@ -66,11 +67,14 @@ const osTheme = useOsTheme()
const theme = computed(() => {
if (prefStore.general.theme === 'auto') {
if (osTheme.value === 'dark') {
WindowSetDarkTheme()
return darkTheme
}
} else if (prefStore.general.theme === 'dark') {
WindowSetDarkTheme()
return darkTheme
}
WindowSetLightTheme()
return lightTheme
})
</script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/AppContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const dragging = computed(() => {
</div>

<!-- log page -->
<div v-if="tabStore.nav === 'log'" class="flex-box-h flex-item-expand">
<div v-show="tabStore.nav === 'log'" class="flex-box-h flex-item-expand">
<keep-alive>
<content-log-pane class="flex-item-expand" />
</keep-alive>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/content/ContentLogPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const loadHistory = () => {
connectionStore
.getCmdHistory()
.then((list) => {
data.history = list
data.history = list || []
})
.finally(() => {
data.loading = false
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/dialogs/PreferencesDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const onClose = () => {
:close-on-esc="false"
:mask-closable="false"
:show-icon="false"
:auto-focus="false"
:title="$t('preferences')"
preset="dialog"
transform-origin="center"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/new_value/NewHashValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const onUpdate = (val) => {
val = reject(val, { key: '' })
emit(
'update:value',
flatMap(val, (item) => [item.key, item.value])
flatMap(val, (item) => [item.key, item.value]),
)
}
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/components/sidebar/NavMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ const preferencesOptions = computed(() => {
key: 'help',
icon: renderIcon(Help),
},
{
label: i18n.t('about'),
key: 'about',
},
{
label: i18n.t('check_update'),
key: 'update',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"warning": "Warning",
"save": "Save",
"none": "None",
"default": "Default",
"new_conn": "Add New Connection",
"new_group": "Add New Group",
"rename_group": "Rename Group",
Expand Down Expand Up @@ -135,7 +136,6 @@
"server": "Server",
"browser": "Browser",
"log": "Log",
"about": "About",
"help": "Help",
"check_update": "Check for Updates...",
"auto_refresh": "Auto Refresh",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/langs/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"warning": "警告",
"save": "保存",
"none": "",
"default": "默认",
"new_conn": "添加新连接",
"new_group": "添加新分组",
"rename_group": "重命名分组",
Expand Down Expand Up @@ -137,7 +138,6 @@
"server": "服务器",
"browser": "浏览器",
"log": "日志",
"about": "关于",
"help": "帮助",
"check_update": "检查更新...",
"auto_refresh": "自动刷新",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'
import App from './App.vue'
import { lang } from './langs'
import './style.scss'
import './styles/style.scss'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime'
Expand All @@ -21,7 +21,7 @@ app.use(
messages: {
...lang,
},
})
}),
)
app.use(createPinia())
app.mount('#app')
2 changes: 1 addition & 1 deletion frontend/src/stores/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const usePreferencesStore = defineStore('preferences', {
}))
option.splice(0, 0, {
value: '',
label: i18n.t('none'),
label: i18n.t('default'),
path: '',
})
return option
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/src/style.scss → frontend/src/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body {
font-style: normal;
font-weight: 400;
src: local(""),
url("assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
url("../assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
}

#app {
Expand Down
6 changes: 6 additions & 0 deletions frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'

const rootPath = new URL('.', import.meta.url).pathname
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
Expand All @@ -21,4 +22,9 @@ export default defineConfig({
}),
Icons(),
],
resolve: {
alias: {
'@': rootPath + 'src',
},
},
})
18 changes: 18 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,41 @@ import (
"context"
"embed"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"runtime"
"tinyrdm/backend/services"
)

//go:embed all:frontend/dist
var assets embed.FS

//go:embed build/appicon.png
var icon []byte

func main() {
// Create an instance of the app structure
app := NewApp()
connSvc := services.Connection()
prefSvc := services.Preferences()

// menu
appMenu := menu.NewMenu()
if runtime.GOOS == "darwin" {
appMenu.Append(menu.AppMenu())
appMenu.Append(menu.EditMenu())
}

// Create application with options
err := wails.Run(&options.App{
Title: "Tiny RDM",
Width: 1024,
Height: 768,
MinWidth: 1024,
MinHeight: 768,
Menu: appMenu,
AssetServer: &assetserver.Options{
Assets: assets,
},
Expand All @@ -51,6 +64,11 @@ func main() {
UseToolbar: false,
HideToolbarSeparator: true,
},
About: &mac.AboutInfo{
Title: "Tiny RDM",
Message: "Copyright © 2023",
Icon: icon,
},
//WebviewIsTransparent: true,
//WindowIsTranslucent: true,
},
Expand Down
13 changes: 10 additions & 3 deletions wails.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"$schema": "https://wails.io/schemas/config.v2.json",
"name": "Tiny RDM",
"outputfilename": "tiny-rdm",
"outputfilename": "Tiny RDM",
"frontend:install": "npm install",
"frontend:build": "npm run build",
"frontend:dev:watcher": "npm run dev",
"frontend:dev:serverUrl": "auto",
"author": {
"name": "Lykin",
"email": "[email protected]"
"name": "tiny-craft",
"email": "[email protected]"
},
"info": {
"companyName": "Tiny Craft",
"productName": "Tiny RDM",
"productVersion": "1.0.0",
"copyright": "Copyright © 2023",
"comments": "Tiny Redis Desktop Manager"
}
}

0 comments on commit 5750170

Please sign in to comment.