-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
7 changed files
with
125 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
desktop-app/src/renderer/components/ToolBar/Menu/Flyout/Settings/SettingsContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useId, useState } from 'react'; | ||
|
||
import Button from 'renderer/components/Button'; | ||
|
||
interface Props { | ||
onClose: () => void; | ||
} | ||
|
||
export const SettingsContent = ({ onClose }: Props) => { | ||
const id = useId(); | ||
const [screenshotSaveLocation, setScreenshotSaveLocation] = useState<string>( | ||
window.electron.store.get('userPreferences.screenshot.saveLocation') | ||
); | ||
|
||
const onSave = () => { | ||
if (screenshotSaveLocation === '' || screenshotSaveLocation == null) { | ||
// eslint-disable-next-line no-alert | ||
alert('Please enter a valid location.'); | ||
return; | ||
} | ||
|
||
window.electron.store.set( | ||
'userPreferences.screenshot.saveLocation', | ||
screenshotSaveLocation | ||
); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<div className="w-[75vw]"> | ||
<h2>Screenshots</h2> | ||
<div className="my-4 flex flex-col space-y-4 text-sm"> | ||
<div className="flex flex-col space-y-2"> | ||
<label htmlFor={id} className="flex flex-col"> | ||
Location | ||
<input | ||
type="text" | ||
id={id} | ||
className="rounded-md border border-gray-300 p-2" | ||
value={screenshotSaveLocation} | ||
onChange={(e) => setScreenshotSaveLocation(e.target.value)} | ||
/> | ||
</label> | ||
<p className="text-sm text-gray-500"> | ||
The location where screenshots will be saved. | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<Button onClick={onSave} isPrimary isTextButton> | ||
Save | ||
</Button> | ||
</div> | ||
); | ||
}; |
31 changes: 31 additions & 0 deletions
31
desktop-app/src/renderer/components/ToolBar/Menu/Flyout/Settings/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useState } from 'react'; | ||
import Button from 'renderer/components/Button'; | ||
import Modal from 'renderer/components/Modal'; | ||
import { SettingsContent } from './SettingsContent'; | ||
|
||
interface Props { | ||
closeFlyout: () => void; | ||
} | ||
|
||
export const Settings = ({ closeFlyout }: Props) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const onClose = () => setIsOpen(false); | ||
|
||
return ( | ||
<div className="relative right-2 w-80"> | ||
<Button | ||
className="right-2 m-0 flex w-80 !justify-start pl-6" | ||
onClick={() => { | ||
setIsOpen(true); | ||
closeFlyout(); | ||
}} | ||
> | ||
Settings | ||
</Button> | ||
<Modal isOpen={isOpen} onClose={onClose} title="Settings"> | ||
<SettingsContent onClose={onClose} /> | ||
</Modal> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters