Skip to content

Commit 69cfb89

Browse files
committed
display notification on save
1 parent ffc9a0c commit 69cfb89

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/react/PauseScreen.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import Button from './Button'
2222
import Screen from './Screen'
2323
import styles from './PauseScreen.module.css'
2424
import { DiscordButton } from './DiscordButton'
25+
import { showNotification } from './NotificationProvider'
2526

2627
export const saveToBrowserMemory = async () => {
2728
setLoadingScreenStatus('Saving world')
@@ -33,10 +34,12 @@ export const saveToBrowserMemory = async () => {
3334
const allRootPaths = [...usedServerPathsV1]
3435
const allFilesToCopy = [] as string[]
3536
for (const dirBase of allRootPaths) {
37+
// eslint-disable-next-line no-await-in-loop
3638
if (dirBase.includes('.') && await fileExistsAsyncOptimized(join(worldFolder, dirBase))) {
3739
allFilesToCopy.push(dirBase)
3840
continue
3941
}
42+
// eslint-disable-next-line no-await-in-loop
4043
let res = await collectFilesToCopy(join(worldFolder, dirBase), true)
4144
if (dirBase === 'region') {
4245
res = res.filter(x => x.endsWith('.mca'))
@@ -133,7 +136,10 @@ export default () => {
133136
}
134137
const action = await showOptionsModal('World actions...', ['Save to browser memory'])
135138
if (action === 'Save to browser memory') {
136-
await saveToBrowserMemory()
139+
const path = await saveToBrowserMemory()
140+
if (!path) return
141+
const saveName = path.split('/').at(-1)
142+
showNotification(`World saved to ${saveName}`, 'Load it to keep your progress!')
137143
// fsState.inMemorySave = true
138144
// fsState.syncFs = false
139145
// fsState.isReadonly = false

0 commit comments

Comments
 (0)