@@ -9,7 +9,10 @@ import {
99import CodeMirror from "@uiw/react-codemirror" ; // CodeMirror editor
1010import { json } from "@codemirror/lang-json" ; // JSON language support for CodeMirror
1111import { downloadVisData , fileDownloaded } from "../../../utils/visualization" ;
12- import { fetchFileVersions , updateFile as updateFileAction } from "../../../actions/file" ;
12+ import {
13+ fetchFileVersions ,
14+ updateFile as updateFileAction ,
15+ } from "../../../actions/file" ;
1316import { readTextFromFile } from "../../../utils/common" ;
1417import { downloadPublicVisData } from "../../../actions/public_visualization" ;
1518import { filePublicDownloaded } from "../../../actions/public_file" ;
@@ -23,10 +26,12 @@ type jsonProps = {
2326} ;
2427
2528export default function JSONVisualizer ( props : jsonProps ) {
26- const { visualizationId, publicView } = props ;
29+ const { visualizationId, publicView } = props ;
2730 // TODO: Use fileData to get the fileid to reflect version change
2831 const fileId = useSelector ( ( state : RootState ) => state . file . fileSummary ?. id ) ;
29- const versionNum = useSelector ( ( state : RootState ) => state . file . selected_version_num ) ;
32+ const versionNum = useSelector (
33+ ( state : RootState ) => state . file . selected_version_num
34+ ) ;
3035 const fileSummary = useSelector ( ( state : RootState ) => state . file . fileSummary ) ;
3136 const fileData = useSelector ( ( state : RootState ) => state . file ) ;
3237
@@ -89,20 +94,16 @@ export default function JSONVisualizer(props: jsonProps) {
8994 } catch ( error ) {
9095 return false ;
9196 }
92- }
97+ } ;
9398
9499 const handleChange = ( value : string ) => {
95100 setJsonContent ( value ) ;
96101 setValidJson ( validateJson ( value ) ) ;
97- }
102+ } ;
98103
99104 const handleSave = async ( ) => {
100105 try {
101- if (
102- jsonContent !== undefined &&
103- fileName &&
104- fileSummary ?. content_type
105- ) {
106+ if ( jsonContent !== undefined && fileName && fileSummary ?. content_type ) {
106107 const textBlob = new Blob ( [ jsonContent ] , { type : "text/plain" } ) ;
107108 const file = new File ( [ textBlob ] , fileName , {
108109 type : fileSummary . content_type . content_type ,
@@ -122,7 +123,7 @@ export default function JSONVisualizer(props: jsonProps) {
122123
123124 const disableSaveButton = ( ) => {
124125 return originalContent === jsonContent || ! validJson ;
125- }
126+ } ;
126127
127128 return (
128129 < Card >
@@ -139,7 +140,12 @@ export default function JSONVisualizer(props: jsonProps) {
139140 ) }
140141 </ CardContent >
141142 < CardActions >
142- < Button variant = "contained" color = "primary" onClick = { handleSave } disabled = { disableSaveButton ( ) } >
143+ < Button
144+ variant = "contained"
145+ color = "primary"
146+ onClick = { handleSave }
147+ disabled = { disableSaveButton ( ) }
148+ >
143149 Save Changes
144150 </ Button >
145151 </ CardActions >
0 commit comments