Skip to content

Commit

Permalink
update component name and fix compatible issue
Browse files Browse the repository at this point in the history
Signed-off-by: huongg <[email protected]>
  • Loading branch information
Huongg committed Jun 5, 2024
1 parent 8c06a8d commit 4431ff0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Button from '../../ui/button';

const CompatibilityView = ({ onClick }) => (
const CompatibilityErrorView = ({ onClick }) => (
<div className="shareable-url-modal__button-wrapper shareable-url-modal__button-wrapper--right">
<Button mode="secondary" onClick={onClick} size="small">
Cancel
Expand All @@ -16,4 +16,4 @@ const CompatibilityView = ({ onClick }) => (
</div>
);

export default CompatibilityView;
export default CompatibilityErrorView;
15 changes: 11 additions & 4 deletions src/components/shareable-url-modal/shareable-url-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import Modal from '../ui/modal';

import PublishedView from './published-view/published-view';
import CompatibilityView from './compatibility-view/compatibility-view';
import CompatibilityErrorView from './compatibility-error-view/compatibility-error-view';
import MainView from './main-view/main-view';
import LoadingView from './loading-view/loading-view';
import ErrorView from './error-view/error-view';
Expand Down Expand Up @@ -170,8 +170,16 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => {
const handleModalClose = () => {
onToggleModal(false);
if (deploymentState !== 'incompatible') {
setDeploymentState('default');
// reset the state to default as long as the user's fsspec package version is compatible
// and there are nothing stored in localStorage
if (Object.keys(hostingPlatformLocalStorageVal).length === 0) {
setDeploymentState('default');
}

// if there are items stored in localStorage, display the published view
displayPublishedView();
}

setResponseError(null);
setIsLoading(false);
setResponseUrl(null);
Expand All @@ -181,7 +189,6 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => {
hasPlatform: false,
hasEndpoint: false,
});
displayPublishedView();
};

const { platform } = inputValues || {};
Expand Down Expand Up @@ -211,7 +218,7 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => {
visible={visible.shareableUrlModal}
>
{!isCompatible ? (
<CompatibilityView onClick={handleModalClose} />
<CompatibilityErrorView onClick={handleModalClose} />
) : showPublishedView ? (
<PublishedView
hostingPlatformLocalStorageVal={hostingPlatformLocalStorageVal}
Expand Down

0 comments on commit 4431ff0

Please sign in to comment.