-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEO-954: "no snapshot available" dialog (#696)
* Refactored connectionInfoState to snapshotInfoState Signed-off-by: Milton Moura <[email protected]> * Draft implementation Signed-off-by: Milton Moura <[email protected]> * Show blocking dialog when unable to load a snapshot from room history Signed-off-by: Milton Moura <[email protected]> * Remove logging and add support for embedded mode Signed-off-by: Milton Moura <[email protected]> * Changes load failure dispatching and associated tests Signed-off-by: Milton Moura <[email protected]> * Update dialog message to something more adequate Signed-off-by: Milton Moura <[email protected]> * Add changeset Signed-off-by: Milton Moura <[email protected]> * Update .changeset/eleven-pans-pull.md Co-authored-by: Kim Brose <[email protected]> Signed-off-by: Milton Moura <[email protected]> * Applying review feedback Signed-off-by: Milton Moura <[email protected]> * Applying further review feedback Signed-off-by: Milton Moura <[email protected]> * Preparing for merge Signed-off-by: Milton Moura <[email protected]> * Rolling back on the connection state store refactor Signed-off-by: Milton Moura <[email protected]> * Move snapshotInfoSlice.ts code into connectionInfoSlice.ts. Signed-off-by: Mikhail Aheichyk <[email protected]> * Fix typo in name Signed-off-by: Mikhail Aheichyk <[email protected]> * Smaller test text changes Signed-off-by: Mikhail Aheichyk <[email protected]> * Add variable Signed-off-by: Mikhail Aheichyk <[email protected]> * Rename snapshotFailed to snapshotSaveFailed Signed-off-by: Mikhail Aheichyk <[email protected]> * Rename setSnapshotSuccessful to setSnapshotSaveSuccessful Signed-off-by: Mikhail Aheichyk <[email protected]> --------- Signed-off-by: Milton Moura <[email protected]> Signed-off-by: Mikhail Aheichyk <[email protected]> Co-authored-by: Kim Brose <[email protected]> Co-authored-by: Mikhail Aheichyk <[email protected]>
- Loading branch information
1 parent
3c6b897
commit 069bf42
Showing
13 changed files
with
307 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@nordeck/matrix-neoboard-widget': minor | ||
'@nordeck/matrix-neoboard-react-sdk': minor | ||
--- | ||
|
||
Show information dialog when snapshot loading fails |
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
58 changes: 58 additions & 0 deletions
58
packages/react-sdk/src/components/connection-state/SnapshotLoadStateDialog.tsx
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,58 @@ | ||
/* | ||
* Copyright 2024 Nordeck IT + Consulting GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogContentText, | ||
DialogTitle, | ||
} from '@mui/material'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useSnapshotLoadState } from './useSnapshotLoadState'; | ||
|
||
export const SnapshotLoadStateDialog: React.FC = () => { | ||
const { t } = useTranslation('neoboard'); | ||
const { snapshotLoadDialogOpen } = useSnapshotLoadState(); | ||
|
||
if (!snapshotLoadDialogOpen) { | ||
return null; | ||
} | ||
|
||
// This dialog can also be triggered by a generic networking error | ||
// that we are unable to handle because the Widget API is not providing additional | ||
// information on the readRelationships call. | ||
// | ||
// We decide to keep this dialog focused on the scenario that relations fail to | ||
// load because the user is unable to retrieve the snapshots due to being in an encrypted room | ||
// or a room with limited history visibility | ||
|
||
return ( | ||
<Dialog open={true} disableEscapeKeyDown={true}> | ||
<DialogTitle> | ||
{t('snapshotLoadState.dialog.title', 'Unable to display the board')} | ||
</DialogTitle> | ||
<DialogContent> | ||
<DialogContentText> | ||
{t( | ||
'snapshotLoadState.dialog.text', | ||
'You will be able to see the contents when another user is working on the board.', | ||
)} | ||
</DialogContentText> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
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
33 changes: 33 additions & 0 deletions
33
packages/react-sdk/src/components/connection-state/useSnapshotLoadState.ts
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,33 @@ | ||
/* | ||
* Copyright 2024 Nordeck IT + Consulting GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { useContext } from 'react'; | ||
import { | ||
ConnectionStateContext, | ||
SnapshotLoadState, | ||
} from './ConnectionStateProvider'; | ||
|
||
export function useSnapshotLoadState(): SnapshotLoadState { | ||
const value = useContext(ConnectionStateContext); | ||
|
||
if (!value) { | ||
throw new Error( | ||
'useConnectionState can only be used inside of <ConnectionStateProvider>', | ||
); | ||
} | ||
|
||
return value; | ||
} |
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
Oops, something went wrong.