-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implemented ui updates and new features
- Loading branch information
Showing
25 changed files
with
702 additions
and
230 deletions.
There are no files selected for viewing
File renamed without changes.
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
File renamed without changes.
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,5 @@ | ||
import ReactDOM from 'react-dom'; | ||
import CreateDiagramDialog from './components/create-diagram-dialog'; | ||
import './styles.css'; | ||
|
||
ReactDOM.render(<CreateDiagramDialog />, document.getElementById('index')); |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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 @@ | ||
import ReactDOM from 'react-dom'; | ||
import EditDiagramDialog from './components/edit-diagram-dialog'; | ||
|
||
import './styles.css'; | ||
|
||
ReactDOM.render(<EditDiagramDialog />, document.getElementById('index')); |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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
104 changes: 104 additions & 0 deletions
104
src/client/select-diagram-dialog/components/select-diagram-dialog.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,104 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { buildUrl, handleDialogClose } from '../../utils/helpers'; | ||
import { serverFunctions } from '../../utils/serverFunctions'; | ||
import useAuth from '../../hooks/useAuth'; | ||
import { CircularProgress, Container, Typography } from '@mui/material'; | ||
|
||
const SelectDiagramDialog = () => { | ||
const { authState, authStatus } = useAuth(); | ||
const [diagramsUrl, setDiagramsUrl] = useState(''); | ||
|
||
useEffect(() => { | ||
if (!authState?.authorized) return; | ||
// const url = buildUrl('/app/plugins/confluence/select', state.token); | ||
const url = buildUrl( | ||
'/app/plugins/select?pluginSource=googledocs', | ||
authState.token | ||
); | ||
setDiagramsUrl(url); | ||
}, [authState]); | ||
|
||
useEffect(() => { | ||
const handleMessage = async (e: MessageEvent) => { | ||
const action = e.data.action; | ||
if (action === 'save') { | ||
const data = e.data.data; | ||
const metadata = new URLSearchParams({ | ||
projectID: data.projectID, | ||
documentID: data.documentID, | ||
major: data.major, | ||
minor: data.minor, | ||
}); | ||
|
||
try { | ||
await serverFunctions.insertBase64ImageWithMetadata( | ||
data.diagramImage, | ||
metadata.toString() | ||
); | ||
handleDialogClose(); | ||
} catch (error) { | ||
console.error('Error inserting image with metadata', error); | ||
} | ||
} | ||
}; | ||
|
||
window.addEventListener('message', handleMessage); | ||
|
||
return () => { | ||
window.removeEventListener('message', handleMessage); | ||
}; | ||
}, []); | ||
|
||
if (authStatus === 'idle' || authStatus === 'loading') { | ||
return ( | ||
<Container | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
height: '96.5vh', | ||
}} | ||
> | ||
<CircularProgress /> | ||
</Container> | ||
); | ||
} | ||
|
||
if (authStatus === 'error') { | ||
return ( | ||
<Container | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
height: '96.5vh', | ||
}} | ||
> | ||
<Typography variant="h5" gutterBottom my={2} textAlign="center"> | ||
Error | ||
</Typography> | ||
<Typography paragraph textAlign="center"> | ||
Something went wrong. Please try again later. | ||
</Typography> | ||
</Container> | ||
); | ||
} | ||
|
||
return ( | ||
<div style={{ padding: '3px', overflowX: 'hidden', height: '100%' }}> | ||
<iframe | ||
src={diagramsUrl} | ||
title="diagrams" | ||
style={{ | ||
border: 'none', | ||
width: '100%', | ||
height: '96.5vh', | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SelectDiagramDialog; |
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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<base target="_top" /> | ||
<!-- Add any external scripts and stylesheets here --> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/react@18.2.0/umd/react.production.min.js" | ||
></script> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js" | ||
></script> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/@mui/material@5.11.11/umd/material-ui.production.min.js" | ||
></script> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/gas-client@1.1.1/dist/index.js" | ||
></script> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/@types/react@18.2.66/index.d.ts" | ||
></script> | ||
</head> | ||
<body> | ||
<section id="index"> | ||
<script type="module" src="./index.jsx"></script> | ||
<!-- bundled js and css will get inlined here during build--> | ||
</section> | ||
</body> | ||
</html> |
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,5 @@ | ||
import ReactDOM from 'react-dom'; | ||
import SelectDiagramDialog from './components/select-diagram-dialog'; | ||
import './styles.css'; | ||
|
||
ReactDOM.render(<SelectDiagramDialog />, document.getElementById('index')); |
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,4 @@ | ||
/* needed to make consistent test snapshots across OSs */ | ||
body { | ||
font-family: Arial !important; | ||
} |
Oops, something went wrong.