diff --git a/.workshop/dev.yaml b/.workshop/dev.yaml index b0ad24a2e..a2969c25e 100644 --- a/.workshop/dev.yaml +++ b/.workshop/dev.yaml @@ -5,18 +5,17 @@ sdks: - name: opencode channel: 1/stable plugs: - hostsvc: + lmstudio: interface: tunnel endpoint: localhost:1234 +#There used to be a plug here for binding your host directory in, but seemingly, OpenCode's sdk has it's own predefined plugin. +#Just use dev/opencode:opencode-config instead + - name: puppeteer-chrome - name: node channel: 20/stable - name: system - plugs: - datasets: - interface: mount - workshop-target: /home/workshop/.config/opencode.json slots: - hostsvc: + lmstudio: interface: tunnel endpoint: localhost:1234 # LM Studio # project requires node 20 and yarn to build so we install them here diff --git a/ui/component/common/file-selector.jsx b/ui/component/common/file-selector.jsx index 9e6403185..c0c6e5a62 100644 --- a/ui/component/common/file-selector.jsx +++ b/ui/component/common/file-selector.jsx @@ -15,7 +15,7 @@ type Props = { error?: string, disabled?: boolean, autoFocus?: boolean, - filters?: Array<{ name: string, extension: string[] }>, + filters?: Array<{ name: string, extensions: string[] }>, readFile?: boolean, }; diff --git a/ui/component/selectAsset/view.jsx b/ui/component/selectAsset/view.jsx index 72ceb9299..1ba7c64ab 100644 --- a/ui/component/selectAsset/view.jsx +++ b/ui/component/selectAsset/view.jsx @@ -33,7 +33,7 @@ type Props = { // For example, to only accept images pass the // following filter: // { name: 'Images', extensions: ['jpg', 'png', 'gif'] }, - filters?: Array<{ name: string, extension: string[] }>, + filters?: Array<{ name: string, extensions: string[] }>, type?: string, }; diff --git a/ui/component/settingAppearance/index.js b/ui/component/settingAppearance/index.js index 7b3f9c2fa..30be10331 100644 --- a/ui/component/settingAppearance/index.js +++ b/ui/component/settingAppearance/index.js @@ -6,6 +6,8 @@ import SettingAppearance from './view'; const select = (state) => ({ disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state), + backgroundMode: makeSelectClientSetting(SETTINGS.APP_BACKGROUND_MODE)(state), + customBackgroundImage: makeSelectClientSetting(SETTINGS.CUSTOM_BACKGROUND_IMAGE)(state), clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state), searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state), hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state), diff --git a/ui/component/settingAppearance/view.jsx b/ui/component/settingAppearance/view.jsx index 2065a5c7e..9c304d0aa 100644 --- a/ui/component/settingAppearance/view.jsx +++ b/ui/component/settingAppearance/view.jsx @@ -4,6 +4,8 @@ import React from 'react'; import * as SETTINGS from 'constants/settings'; import Card from 'component/common/card'; import { FormField } from 'component/common/form'; +import Button from 'component/button'; +import FileSelector from 'component/common/file-selector'; import HomepageSelector from 'component/homepageSelector'; import SettingLanguage from 'component/settingLanguage'; import SettingsRow from 'component/settingsRow'; @@ -13,6 +15,8 @@ import homepages from 'homepages'; type Props = { disableBackground: boolean, + backgroundMode: string, + customBackgroundImage: string, clock24h: boolean, searchInLanguage: boolean, hideBalance: boolean, @@ -21,7 +25,29 @@ type Props = { }; export default function SettingAppearance(props: Props) { - const { clock24h, disableBackground, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props; + const { + clock24h, + disableBackground, + backgroundMode, + customBackgroundImage, + searchInLanguage, + hideBalance, + setClientSetting, + setSearchInLanguage, + } = props; + + function handleBackgroundImageChosen(fileWithPath: FileWithPath) { + const file = fileWithPath && fileWithPath.file; + if (!file) return; + + const reader = new FileReader(); + reader.onload = () => { + if (reader.result) { + setClientSetting(SETTINGS.CUSTOM_BACKGROUND_IMAGE, reader.result.toString()); + } + }; + reader.readAsDataURL(file); + } return ( <> @@ -64,6 +90,44 @@ export default function SettingAppearance(props: Props) { checked={clock24h} /> + + setClientSetting(SETTINGS.APP_BACKGROUND_MODE, e.target.value)} + > + + + + + + {backgroundMode === SETTINGS.APP_BACKGROUND_MODES.CUSTOM && ( + + + {customBackgroundImage && ( +