Skip to content

Commit

Permalink
update hew to v0.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkim-det committed Nov 7, 2023
1 parent 61beae9 commit 3b50c97
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 74 deletions.
6 changes: 3 additions & 3 deletions webui/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webui/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"fp-ts": "^2.13.1",
"fuse.js": "^6.6.2",
"hermes-parallel-coordinates": "^0.6.17",
"hew": "git+https://[email protected]/determined-ai/hew.git#WEB-1697",
"hew": "git+https://[email protected]/determined-ai/hew.git#v0.6.3",
"humanize-duration": "^3.28.0",
"immutable": "^4.3.0",
"io-ts": "^2.2.20",
Expand Down
49 changes: 1 addition & 48 deletions webui/react/src/pages/DesignKit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ import Input from 'hew/Input';
import InputNumber from 'hew/InputNumber';
import InputSearch from 'hew/InputSearch';
import InputShortcut, { KeyboardShortcut } from 'hew/InputShortcut';
import { Note, Serie, XAxisDomain } from 'hew/internal/types';
import { Serie, XAxisDomain } from 'hew/internal/types';
import { LineChart } from 'hew/LineChart';
import { useChartGrid } from 'hew/LineChart/useChartGrid';
import LogViewer from 'hew/LogViewer/LogViewer';
import Message from 'hew/Message';
import { Modal, useModal } from 'hew/Modal';
import Nameplate from 'hew/Nameplate';
import Notes, { Props as NotesProps } from 'hew/Notes';
import Pagination from 'hew/Pagination';
import Pivot from 'hew/Pivot';
import Select, { Option } from 'hew/Select';
Expand Down Expand Up @@ -98,7 +97,6 @@ const ComponentTitles = {
Message: 'Message',
Modals: 'Modals',
Nameplate: 'Nameplate',
Notes: 'Notes',
Pagination: 'Pagination',
Pivot: 'Pivot',
Select: 'Select',
Expand Down Expand Up @@ -1531,50 +1529,6 @@ const BreadcrumbsSection: React.FC = () => {
);
};

const useNoteDemo = (): ((props?: Omit<NotesProps, 'multiple'>) => JSX.Element) => {
const [note, setNote] = useState<Note>({ contents: '', name: 'Untitled' });
const onSave = async (n: Note) => await setNote(n);
return (props) => <Notes onError={handleError} {...props} notes={note} onSave={onSave} />;
};

const useNotesDemo = (): ((props?: NotesProps) => JSX.Element) => {
const [notes, setNotes] = useState<Note[]>([]);
const onDelete = (p: number) => setNotes((n) => n.filter((_, idx) => idx !== p));
const onNewPage = () => setNotes((n) => [...n, { contents: '', name: 'Untitled' }]);
const onSave = async (n: Note[]) => await setNotes(n);
return (props) => (
<Notes
{...props}
multiple
notes={notes}
onDelete={onDelete}
onError={handleError}
onNewPage={onNewPage}
onSave={onSave}
/>
);
};

const NotesSection: React.FC = () => {
return (
<ComponentSection id="Notes" title="Notes">
<AntDCard>
<p>
A <code>{'<Notes>'}</code> is used for taking notes. It can be single page note or multi
pages notes. Each page of note consists of a title and a sheet of note.
</p>
</AntDCard>
<AntDCard title="Usage">
<strong>Single page note</strong>
{useNoteDemo()()}
<hr />
<strong>Multi pages notes</strong>
{useNotesDemo()()}
</AntDCard>
</ComponentSection>
);
};

const AvatarSection: React.FC = () => {
return (
<ComponentSection id="Avatar" title="Avatar">
Expand Down Expand Up @@ -3024,7 +2978,6 @@ const Components = {
Message: <MessageSection />,
Modals: <ModalSection />,
Nameplate: <NameplateSection />,
Notes: <NotesSection />,
Pagination: <PaginationSection />,
Pivot: <PivotSection />,
Select: <SelectSection />,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TabsProps } from 'antd';
import Notes from 'hew/Notes';
import Pivot from 'hew/Pivot';
import Notes from 'hew/RichTextEditor';
import Spinner from 'hew/Spinner';
import { string } from 'io-ts';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
Expand Down Expand Up @@ -163,7 +163,7 @@ const ExperimentMultiTrialTabs: React.FC<Props> = ({
<Notes
disabled={!editableNotes}
disableTitle
notes={{ contents: experiment.notes ?? '', name: 'Notes' }}
docs={{ contents: experiment.notes ?? '', name: 'Notes' }}
onError={handleError}
onPageUnloadHook={unstable_useBlocker}
onSave={handleNotesUpdate}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TabsProps } from 'antd';
import Button from 'hew/Button';
import Message from 'hew/Message';
import Notes from 'hew/Notes';
import Pivot from 'hew/Pivot';
import Notes from 'hew/RichTextEditor';
import Spinner from 'hew/Spinner';
import Tooltip from 'hew/Tooltip';
import { string } from 'io-ts';
Expand Down Expand Up @@ -296,7 +296,7 @@ const ExperimentSingleTrialTabs: React.FC<Props> = ({
<Notes
disabled={!editableNotes}
disableTitle
notes={{ contents: experiment.notes ?? '', name: 'Notes' }}
docs={{ contents: experiment.notes ?? '', name: 'Notes' }}
onError={handleError}
onPageUnloadHook={unstable_useBlocker}
onSave={handleNotesUpdate}
Expand Down
16 changes: 8 additions & 8 deletions webui/react/src/pages/ModelDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Typography } from 'antd';
import { FilterValue, SorterResult, TablePaginationConfig } from 'antd/lib/table/interface';
import Input from 'hew/Input';
import Message from 'hew/Message';
import Notes from 'hew/Notes';
import Notes from 'hew/RichTextEditor';
import Spinner from 'hew/Spinner';
import Tags, { tagsActionHelper } from 'hew/Tags';
import { Loadable, Loaded, NotLoaded } from 'hew/utils/loadable';
Expand Down Expand Up @@ -389,13 +389,13 @@ const ModelDetails: React.FC = () => {
pageBreadcrumb.push(
workspace.id === 1
? {
breadcrumbName: 'Uncategorized Experiments',
path: paths.projectDetails(1),
}
breadcrumbName: 'Uncategorized Experiments',
path: paths.projectDetails(1),
}
: {
breadcrumbName: workspace.name,
path: paths.workspaceDetails(workspace.id),
},
breadcrumbName: workspace.name,
path: paths.workspaceDetails(workspace.id),
},
{
breadcrumbName: 'Model Registry',
path:
Expand Down Expand Up @@ -460,7 +460,7 @@ const ModelDetails: React.FC = () => {
<Notes
disabled={model.archived || !canModifyModel({ model: model })}
disableTitle
notes={{ contents: model.notes ?? '', name: 'Notes' }}
docs={{ contents: model.notes ?? '', name: 'Notes' }}
onError={handleError}
onPageUnloadHook={unstable_useBlocker}
onSave={saveNotes}
Expand Down
16 changes: 8 additions & 8 deletions webui/react/src/pages/ModelVersionDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Card, type TabsProps } from 'antd';
import Breadcrumb from 'hew/Breadcrumb';
import Message from 'hew/Message';
import Notes from 'hew/Notes';
import Pivot from 'hew/Pivot';
import Notes from 'hew/RichTextEditor';
import Spinner from 'hew/Spinner';
import { Loadable, Loaded, NotLoaded } from 'hew/utils/loadable';
import _ from 'lodash';
Expand Down Expand Up @@ -268,7 +268,7 @@ const ModelVersionDetails: React.FC = () => {
<Notes
disabled={modelVersion.model.archived || !canModifyModelVersion({ modelVersion })}
disableTitle
notes={{ contents: modelVersion.notes ?? '', name: 'Notes' }}
docs={{ contents: modelVersion.notes ?? '', name: 'Notes' }}
onError={handleError}
onPageUnloadHook={unstable_useBlocker}
onSave={saveNotes}
Expand Down Expand Up @@ -304,13 +304,13 @@ const ModelVersionDetails: React.FC = () => {
const pageBreadcrumb: BreadCrumbRoute[] = [
isUncategorized
? {
breadcrumbName: 'Uncategorized Experiments',
path: paths.projectDetails(1),
}
breadcrumbName: 'Uncategorized Experiments',
path: paths.projectDetails(1),
}
: {
breadcrumbName: workspace.name,
path: paths.workspaceDetails(workspace.id),
},
breadcrumbName: workspace.name,
path: paths.workspaceDetails(workspace.id),
},
{
breadcrumbName: 'Model Registry',
path: isUncategorized
Expand Down
4 changes: 2 additions & 2 deletions webui/react/src/pages/ProjectNotes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useModal } from 'hew/Modal';
import Notes from 'hew/Notes';
import Notes from 'hew/RichTextEditor';
import React, { useCallback, useState } from 'react';
import { unstable_useBlocker } from 'react-router-dom';

Expand Down Expand Up @@ -64,8 +64,8 @@ const ProjectNotes: React.FC<Props> = ({ project, fetchProject }) => {
<>
<Notes
disabled={project?.archived || !editPermission}
docs={project?.notes ?? []}
multiple
notes={project?.notes ?? []}
onDelete={handleDeleteNote}
onError={handleError}
onNewPage={handleNewNotesPage}
Expand Down

0 comments on commit 3b50c97

Please sign in to comment.