Skip to content

Commit

Permalink
update versions to version
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <[email protected]>
  • Loading branch information
Huong Nguyen committed Jan 22, 2025
1 parent 55d98fc commit ac70a92
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/update-reminder/update-reminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function replaceBackticksWithCodeBlocks(text) {
return text.replace(regex, '<code>$1</code>');
}

const UpdateReminder = ({ isOutdated, versions, visibleMetaSidebar }) => {
const UpdateReminder = ({ isOutdated, version, visibleMetaSidebar }) => {
const [dismissed, setDismissed] = useState(false);
const [expand, setExpand] = useState(false);
const { latest, installed } = versions;
const { latest, installed } = version;

const command = 'pip install -U kedro-viz';

Expand Down
16 changes: 8 additions & 8 deletions src/components/update-reminder/update-reminder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionOutOfDate.isOutdated}
versions={versionOutOfDate}
version={versionOutOfDate}
/>
);
expect(wrapper.find('.update-reminder-unexpanded').length).toBe(1);
Expand All @@ -31,7 +31,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionOutOfDate.isOutdated}
versions={versionOutOfDate}
version={versionOutOfDate}
/>
);
const container = wrapper.find('.update-reminder-unexpanded');
Expand All @@ -44,7 +44,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionOutOfDate.isOutdated}
versions={versionOutOfDate}
version={versionOutOfDate}
/>
);
const container = wrapper.find('.update-reminder-unexpanded');
Expand All @@ -56,7 +56,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionOutOfDate.isOutdated}
versions={versionOutOfDate}
version={versionOutOfDate}
/>
);
wrapper.find('.buttons-container').find('button').at(1).simulate('click');
Expand All @@ -69,7 +69,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionsUpToDate.isOutdated}
versions={versionsUpToDate}
version={versionsUpToDate}
/>
);
expect(
Expand All @@ -81,7 +81,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionOutOfDate.isOutdated}
versions={versionOutOfDate}
version={versionOutOfDate}
/>
);
const container = wrapper.find('.update-reminder-unexpanded');
Expand All @@ -96,7 +96,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionOutOfDate.isOutdated}
versions={versionOutOfDate}
version={versionOutOfDate}
/>
);
const container = wrapper.find('.update-reminder-unexpanded');
Expand All @@ -110,7 +110,7 @@ describe('Update Reminder', () => {
const wrapper = setup.mount(
<UpdateReminder
isOutdated={versionsUpToDate.isOutdated}
versions={versionsUpToDate}
version={versionsUpToDate}
/>
);
const container = wrapper.find('.update-reminder-version-tag--up-to-date');
Expand Down
8 changes: 4 additions & 4 deletions src/components/wrapper/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import './wrapper.scss';
export const Wrapper = ({ displayGlobalNavigation, theme }) => {
const [isOutdated, setIsOutdated] = useState(false);
const [latestVersion, setLatestVersion] = useState(null);
const [versions, setVersions] = useState(null);
const [version, setVersion] = useState(null);

useEffect(() => {
async function checkKedroVizVersion() {
Expand All @@ -30,7 +30,7 @@ export const Wrapper = ({ displayGlobalNavigation, theme }) => {
if (request.ok) {
setIsOutdated(response.is_outdated);
setLatestVersion(response.latest);
setVersions(response);
setVersion(response);
}
} catch (error) {
console.error('Error fetching Kedro-Viz version:', error);
Expand All @@ -57,8 +57,8 @@ export const Wrapper = ({ displayGlobalNavigation, theme }) => {
latestVersion={latestVersion}
/>
{isRunningLocally() ? <ShareableUrlModal /> : null}
{versions && (
<UpdateReminder isOutdated={isOutdated} versions={versions} />
{version && (
<UpdateReminder isOutdated={isOutdated} version={version} />
)}
<Switch>
<Route exact path="/">
Expand Down

0 comments on commit ac70a92

Please sign in to comment.