refactor: replace 'preact' with 'react' (#1048)

This commit is contained in:
Aman Harwara
2022-05-30 12:42:52 +05:30
committed by GitHub
parent e74b4953ea
commit 8c368dd96b
231 changed files with 4794 additions and 4302 deletions

View File

@@ -1,7 +1,6 @@
import { AppState } from '@/UIModels/AppState'
import { SNApplication, SessionStrings, UuidString, isNullOrUndefined, RemoteSession } from '@standardnotes/snjs'
import { FunctionComponent } from 'preact'
import { useState, useEffect, useRef, useMemo } from 'preact/hooks'
import { FunctionComponent, useState, useEffect, useRef, useMemo } from 'react'
import { Dialog } from '@reach/dialog'
import { Alert } from '@reach/alert'
import { AlertDialog, AlertDialogDescription, AlertDialogLabel } from '@reach/alert-dialog'
@@ -103,23 +102,23 @@ const SessionsModalContent: FunctionComponent<{
<>
<Dialog onDismiss={close} className="sessions-modal h-90vh">
<div className="sk-modal-content">
<div class="sn-component">
<div class="sk-panel">
<div class="sk-panel-header">
<div class="sk-panel-header-title">Active Sessions</div>
<div className="sn-component">
<div className="sk-panel">
<div className="sk-panel-header">
<div className="sk-panel-header-title">Active Sessions</div>
<div className="buttons">
<button class="sk-a close-button info" disabled={refreshing} onClick={refresh}>
<button className="sk-a close-button info" disabled={refreshing} onClick={refresh}>
Refresh
</button>
<button class="sk-a close-button info" onClick={close}>
<button className="sk-a close-button info" onClick={close}>
Close
</button>
</div>
</div>
<div class="sk-panel-content overflow-y-auto">
<div className="sk-panel-content overflow-y-auto">
{refreshing ? (
<>
<div class="sk-spinner small info"></div>
<div className="sk-spinner small info"></div>
<h2 className="sk-p sessions-modal-refreshing">Loading sessions</h2>
</>
) : (
@@ -128,7 +127,7 @@ const SessionsModalContent: FunctionComponent<{
{sessions.length > 0 && (
<ul>
{sessions.map((session) => (
<li>
<li key={session.uuid}>
<h2>{session.device_info}</h2>
{session.current ? (
<span className="info bold">Current session</span>
@@ -202,13 +201,15 @@ const SessionsModalContent: FunctionComponent<{
)
}
export const SessionsModal: FunctionComponent<{
const SessionsModal: FunctionComponent<{
appState: AppState
application: WebApplication
}> = observer(({ appState, application }) => {
}> = ({ appState, application }) => {
if (appState.isSessionsModalVisible) {
return <SessionsModalContent application={application} appState={appState} />
} else {
return null
}
})
}
export default observer(SessionsModal)