-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c718eec
commit 9a6ffa0
Showing
11 changed files
with
136 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import got from 'got'; | ||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; | ||
import MarkdownRenderer from '../markdownRenderer'; | ||
|
||
type IProps = { | ||
opened: boolean; | ||
setOpened: (opened: boolean) => void; | ||
}; | ||
|
||
const API = | ||
'https://raw.githubusercontent.com/jopemachine/arvis/master/CHANGE_LOG.md'; | ||
|
||
const ChangeLogModal = (props: IProps) => { | ||
const { opened, setOpened } = props; | ||
const [content, setContent] = useState<string>(); | ||
|
||
const toggle = () => setOpened(!opened); | ||
|
||
useEffect(() => { | ||
got.get(API).then((response) => setContent(response.body)); | ||
}, []); | ||
|
||
return ( | ||
<Modal | ||
fade | ||
centered | ||
isOpen={opened} | ||
toggle={toggle} | ||
con="changeLogModal" | ||
style={{ | ||
color: '#212529', | ||
}} | ||
> | ||
<ModalHeader toggle={toggle}>Change Log</ModalHeader> | ||
<ModalBody style={{ height: 600 }}> | ||
{content && ( | ||
<MarkdownRenderer | ||
width="93%" | ||
height="90%" | ||
data={content} | ||
padding={10} | ||
/> | ||
)} | ||
{!content && 'Loading..'} | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="primary" onClick={() => setOpened(false)}> | ||
Confirm | ||
</Button> | ||
</ModalFooter> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ChangeLogModal; |
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
File renamed without changes.
File renamed without changes.
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
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,26 @@ | ||
import { app } from 'electron'; | ||
import fse from 'fs-extra'; | ||
import path from 'path'; | ||
import pkg from '../config/pkg'; | ||
|
||
export const isThisVersionFirstLaunching = (): boolean => { | ||
const checkFile = path.join( | ||
app.getPath('userData'), | ||
`.electron-util--has-app-launched-${pkg.version}` | ||
); | ||
|
||
if (fse.existsSync(checkFile)) { | ||
return false; | ||
} | ||
|
||
try { | ||
fse.writeFileSync(checkFile, ''); | ||
} catch (error: any) { | ||
if (error.code === 'ENOENT') { | ||
fse.mkdirSync(app.getPath('userData')); | ||
return isThisVersionFirstLaunching(); | ||
} | ||
} | ||
|
||
return true; | ||
}; |
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