mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
fix initialize bug & tutorial modal
This commit is contained in:
@@ -118,15 +118,15 @@ export function emit (type, data = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let storeData = dataStore.getData()
|
let storeData = dataStore.getData()
|
||||||
todayRecord.FOLDER_COUNT = _.isArray(storeData.folders) ? storeData.folders.length : 0
|
todayRecord.FOLDER_COUNT = storeData && _.isArray(storeData.folders) ? storeData.folders.length : 0
|
||||||
todayRecord.ARTICLE_COUNT = _.isArray(storeData.articles) ? storeData.articles.length : 0
|
todayRecord.ARTICLE_COUNT = storeData && _.isArray(storeData.articles) ? storeData.articles.length : 0
|
||||||
todayRecord.CLIENT_VERSION = version
|
todayRecord.CLIENT_VERSION = version
|
||||||
|
|
||||||
todayRecord.SYNTAX_COUNT = storeData.articles.reduce((sum, article) => {
|
todayRecord.SYNTAX_COUNT = storeData && _.isArray(storeData.articles) ? storeData.articles.reduce((sum, article) => {
|
||||||
if (sum[article.mode] == null) sum[article.mode] = 1
|
if (sum[article.mode] == null) sum[article.mode] = 1
|
||||||
else sum[article.mode]++
|
else sum[article.mode]++
|
||||||
return sum
|
return sum
|
||||||
}, {})
|
}, {}) : 0
|
||||||
|
|
||||||
saveAllRecords(records)
|
saveAllRecords(records)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ export function init () {
|
|||||||
// set repositories info
|
// set repositories info
|
||||||
getRepositories()
|
getRepositories()
|
||||||
|
|
||||||
// set local.json
|
data = getData()
|
||||||
let data = jetpack.read(getLocalPath(), 'json')
|
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
// for 0.4.1 -> 0.4.2
|
// for 0.4.1 -> 0.4.2
|
||||||
@@ -105,12 +104,19 @@ export function init () {
|
|||||||
folders: [defaultFolder],
|
folders: [defaultFolder],
|
||||||
version: '0.4'
|
version: '0.4'
|
||||||
}
|
}
|
||||||
queueSave()
|
saveData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getData () {
|
export function getData () {
|
||||||
if (data == null) data = jetpack.read(getLocalPath(), 'json')
|
if (data == null) {
|
||||||
|
try {
|
||||||
|
data = jetpack.read(getLocalPath(), 'json')
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export default class Tutorial extends React.Component {
|
|||||||
Boost supports code syntax highlighting.<br/>
|
Boost supports code syntax highlighting.<br/>
|
||||||
There are more than 100 different type of language.
|
There are more than 100 different type of language.
|
||||||
<div className='code'>
|
<div className='code'>
|
||||||
<CodeEditor readOnly mode='jsx' code={code}/>
|
<CodeEditor readOnly article={{content:code, mode: 'jsx'}}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>)
|
||||||
@@ -94,7 +94,7 @@ export default class Tutorial extends React.Component {
|
|||||||
by selecting your file with pressing Enter key,<br/>
|
by selecting your file with pressing Enter key,<br/>
|
||||||
and to paste the contents of the Clipboard with [{process.platform === 'darwin' ? 'Command' : 'Control'}-V]
|
and to paste the contents of the Clipboard with [{process.platform === 'darwin' ? 'Command' : 'Control'}-V]
|
||||||
|
|
||||||
<img width='480' src='../../resources/finder.png'/>
|
<img width='480' src='../resources/finder.png'/>
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>)
|
||||||
case 4:
|
case 4:
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ const initialStatus = {
|
|||||||
|
|
||||||
let data = dataStore.getData()
|
let data = dataStore.getData()
|
||||||
let initialArticles = {
|
let initialArticles = {
|
||||||
data: data.articles,
|
data: data && data.articles ? data.articles : [],
|
||||||
modified: []
|
modified: []
|
||||||
}
|
}
|
||||||
let initialFolders = data.folders
|
let initialFolders = data && data.folders ? data.folders : []
|
||||||
let initialUser = dataStore.getUser().user
|
let initialUser = dataStore.getUser().user
|
||||||
|
|
||||||
function user (state = initialUser, action) {
|
function user (state = initialUser, action) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ slideBgColor4 = #00B493
|
|||||||
|
|
||||||
.Tutorial.modal
|
.Tutorial.modal
|
||||||
background-color slideBgColor0
|
background-color slideBgColor0
|
||||||
color white
|
color white !important
|
||||||
width 720px
|
width 720px
|
||||||
height 480px
|
height 480px
|
||||||
margin-top 75px
|
margin-top 75px
|
||||||
|
|||||||
Reference in New Issue
Block a user