forked from Mirrors/gomuks
web/settings: add loading view for vs code
This commit is contained in:
parent
92c5e86689
commit
b1c02a3b69
2 changed files with 19 additions and 7 deletions
|
@ -60,6 +60,15 @@ div.settings-view {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
background-color: var(--background-color);
|
||||||
|
|
||||||
|
> div.loader {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> div.buttons {
|
> div.buttons {
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
import { lazy, use, useCallback, useRef, useState } from "react"
|
import { Suspense, lazy, use, useCallback, useRef, useState } from "react"
|
||||||
|
import { ScaleLoader } from "react-spinners"
|
||||||
import Client from "@/api/client.ts"
|
import Client from "@/api/client.ts"
|
||||||
import { RoomStateStore, usePreferences } from "@/api/statestore"
|
import { RoomStateStore, usePreferences } from "@/api/statestore"
|
||||||
import {
|
import {
|
||||||
|
@ -242,12 +243,14 @@ const CustomCSSInput = ({ setPref, room }: { setPref: SetPrefFunc, room: RoomSta
|
||||||
</span>}
|
</span>}
|
||||||
</div>
|
</div>
|
||||||
{vscodeOpen ? <div className="vscode-wrapper">
|
{vscodeOpen ? <div className="vscode-wrapper">
|
||||||
<Monaco
|
<Suspense fallback={<div className="loader"><ScaleLoader width={40} height={80} color="var(--primary-color)"/></div>}>
|
||||||
initData={vscodeInitialContentRef.current}
|
<Monaco
|
||||||
onClose={closeVSCode}
|
initData={vscodeInitialContentRef.current}
|
||||||
onSave={onSave}
|
onClose={closeVSCode}
|
||||||
contentRef={vscodeContentRef}
|
onSave={onSave}
|
||||||
/>
|
contentRef={vscodeContentRef}
|
||||||
|
/>
|
||||||
|
</Suspense>
|
||||||
</div> : <textarea value={text} onChange={onChangeText}/>}
|
</div> : <textarea value={text} onChange={onChangeText}/>}
|
||||||
<div className="buttons">
|
<div className="buttons">
|
||||||
<button onClick={onClickVSCode}>Open in VS Code</button>
|
<button onClick={onClickVSCode}>Open in VS Code</button>
|
||||||
|
|
Loading…
Add table
Reference in a new issue