Skip to content

Commit

Permalink
Autoformatted some code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurredr committed Sep 18, 2021
1 parent 2a9d52f commit 285fea8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none"
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none"
}
6 changes: 3 additions & 3 deletions packages/main/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ const createWindow = async () => {
mainWindow?.show()

// Open devTools on start
// if (import.meta.env.MODE === 'development') {
// mainWindow?.webContents.openDevTools()
// }
if (import.meta.env.MODE === 'development') {
mainWindow?.webContents.openDevTools()
}
})

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/preload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ if (process.contextIsolated) {
* @see https://github.com/substack/deep-freeze
* @param obj Object on which to lock the attributes
*/

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const deepFreeze = (obj: any) => {
// eslint-disable-line @typescript-eslint/no-explicit-any
if (typeof obj === 'object' && obj !== null) {
Object.keys(obj).forEach((prop) => {
const val = obj[prop]
Expand Down
13 changes: 8 additions & 5 deletions packages/renderer/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ import type ipcWindow from './types/IpcTypes'

const App: React.FC = () => {
const [doc, setDoc] = useState<string>('# Hello, World!\n')
const [currentSavedDoc, setCurrentSavedDoc] = useState<string | null>(null)
const [fileName, setFileName] = useState<string>('Untitled file')
const [saved, setSaved] = useState<boolean>(false)

const handleDocChange = useCallback((newDoc) => {
if (newDoc !== doc) {
const handleDocChange = useCallback((newDoc: string) => {
if (currentSavedDoc !== newDoc) {
setSaved(false)
setDoc(newDoc)
}
}, [])
}, [currentSavedDoc])

// Document saved
useEffect(() => {
;(window as unknown as ipcWindow).ipcRenderer.receive(
'document-saved',
(filePath: string) => {
setSaved(true)
setCurrentSavedDoc(doc)
setFileName(filePath)
setSaved(true)
}
)
}, [])
Expand All @@ -33,9 +35,10 @@ const App: React.FC = () => {
;(window as unknown as ipcWindow).ipcRenderer.receive(
'document-opened',
(filePath: string, content: string) => {
setSaved(true)
setFileName(filePath)
setDoc(content)
setCurrentSavedDoc(content)
setSaved(true)
}
)
}, [])
Expand Down

0 comments on commit 285fea8

Please sign in to comment.