Skip to content

Commit

Permalink
Merge pull request #4315 from specify/issue-4314
Browse files Browse the repository at this point in the history
  • Loading branch information
grantfitzsimmons committed Dec 22, 2023
2 parents 6e56723 + 263a9d3 commit 825edf1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 28 deletions.
@@ -1,13 +1,14 @@
import { AttachmentWorkStateProps } from './types';
import { Dialog } from '../Molecules/Dialog';
import { Button } from '../Atoms/Button';
import { wbText } from '../../localization/workbench';
import React from 'react';

import { attachmentsText } from '../../localization/attachments';
import { Progress } from '../Atoms';
import { commonText } from '../../localization/common';
import { wbText } from '../../localization/workbench';
import { formatTime } from '../../utils/utils';
import React from 'react';
import { Progress } from '../Atoms';
import { Button } from '../Atoms/Button';
import { formatNumber } from '../Atoms/Internationalization';
import { Dialog } from '../Molecules/Dialog';
import type { AttachmentWorkStateProps } from './types';

export function ActionState({
workProgress,
Expand Down
Expand Up @@ -4,11 +4,11 @@ import { commonText } from '../../localization/common';
import { wbText } from '../../localization/workbench';
import type { RA } from '../../utils/types';
import { Button } from '../Atoms/Button';
import { loadingBar } from '../Molecules';
import { Dialog } from '../Molecules/Dialog';
import type { AttachmentUploadSpec } from './Import';
import type { PartialUploadableFileSpec } from './types';
import { validateAttachmentFiles } from './utils';
import { loadingBar } from '../Molecules';

export function AttachmentsValidationDialog({
files,
Expand Down
@@ -1,8 +1,12 @@
import { SchemaViewerRow, SchemaViewerValue } from '../SchemaViewer/helpers';
import { RA, RR } from '../../utils/types';
import { LocalizedString } from 'typesafe-i18n';
import React from 'react';
import type { LocalizedString } from 'typesafe-i18n';

import type { RA, RR } from '../../utils/types';
import { Link } from '../Atoms/Link';
import type {
SchemaViewerRow,
SchemaViewerValue,
} from '../SchemaViewer/helpers';

export function GenericSortedDataViewer<
DATA extends SchemaViewerRow<RR<string, SchemaViewerValue>>
Expand Down Expand Up @@ -63,7 +67,8 @@ export function GenericSortedDataViewer<
);
});
const indexValue = row[indexColumn];
const key = typeof indexValue === 'object' ? indexValue[0] : indexValue;
const key =
typeof indexValue === 'object' ? indexValue[0] : indexValue;
const link = getLink?.(row);
return typeof link === 'string' ? (
<Link.Default href={link} key={key as string} role="row">
Expand Down
Expand Up @@ -269,7 +269,7 @@ export function Categories({
{typeof handleAdd === 'function' ? (
<div className="flex gap-2">
<Button.Small
variant={className.secondaryButton}
variant={className.borderedGrayButton}
onClick={(): void =>
handleRemove?.(categoryIndex, undefined)
}
Expand Down
22 changes: 11 additions & 11 deletions specifyweb/frontend/js_src/lib/components/Statistics/index.tsx
Expand Up @@ -529,11 +529,11 @@ function ProtectedStatsPage(): JSX.Element | null {
<DateElement date={pageLastUpdated} />
</span>
)}
<Button.Secondary onClick={(): void => refreshPage()}>
<Button.BorderedGray onClick={(): void => refreshPage()}>
{statsText.refresh()}
</Button.Secondary>
</Button.BorderedGray>
{Object.values(layout).every((layouts) => layouts !== undefined) && (
<Button.Secondary
<Button.BorderedGray
onClick={(): void => {
const date = new Date();
const sourceIndex = activePage.isShared ? 0 : 1;
Expand All @@ -555,12 +555,12 @@ function ProtectedStatsPage(): JSX.Element | null {
}}
>
{statsText.downloadAsTSV()}
</Button.Secondary>
</Button.BorderedGray>
)}
{isEditing ? (
<>
{process.env.NODE_ENV === 'development' && (
<Button.Secondary
<Button.BorderedGray
onClick={(): void => {
cleanThrottledPromises();
handleSharedLayoutChange(undefined);
Expand All @@ -574,10 +574,10 @@ function ProtectedStatsPage(): JSX.Element | null {
}}
>
{`${commonText.reset()} [DEV]`}
</Button.Secondary>
</Button.BorderedGray>
)}

<Button.Secondary
<Button.BorderedGray
onClick={(): void => {
handleSharedLayoutChange(previousCollectionLayout.current);
handlePersonalLayoutChange(previousLayout.current);
Expand All @@ -602,12 +602,12 @@ function ProtectedStatsPage(): JSX.Element | null {
}}
>
{commonText.cancel()}
</Button.Secondary>
</Button.BorderedGray>
<Submit.Save>{commonText.save()}</Submit.Save>
</>
) : (
canEdit && (
<Button.Secondary
<Button.BorderedGray
onClick={(): void => {
setState({
type: 'EditingState',
Expand All @@ -619,7 +619,7 @@ function ProtectedStatsPage(): JSX.Element | null {
}}
>
{commonText.edit()}
</Button.Secondary>
</Button.BorderedGray>
)
)}
</div>
Expand All @@ -643,7 +643,7 @@ function ProtectedStatsPage(): JSX.Element | null {
{isEditing && canEditIndex(index === 0) && (
<div className="flex flex-1">
<Button.Icon
className={`max-w-fit ${className.secondaryButton}`}
className="max-w-fit"
icon="plus"
title={commonText.add()}
onClick={(): void =>
Expand Down
Expand Up @@ -6,6 +6,7 @@

import React from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import type { LocalizedString } from 'typesafe-i18n';

import { useAsyncState } from '../../hooks/useAsyncState';
import { commonText } from '../../localization/common';
Expand All @@ -17,6 +18,7 @@ import { Button } from '../Atoms/Button';
import { className } from '../Atoms/className';
import { icons } from '../Atoms/Icons';
import { Link } from '../Atoms/Link';
import type { AttachmentDataSet } from '../AttachmentsBulkImport/types';
import { LoadingContext } from '../Core/Contexts';
import { getField } from '../DataModel/helpers';
import { schema } from '../DataModel/schema';
Expand All @@ -30,8 +32,6 @@ import { OverlayContext } from '../Router/Router';
import { uniquifyDataSetName } from '../WbImport/helpers';
import type { Dataset, DatasetBrief } from '../WbPlanView/Wrapped';
import { WbDataSetMeta } from '../WorkBench/DataSetMeta';
import { AttachmentDataSet } from '../AttachmentsBulkImport/types';
import { LocalizedString } from 'typesafe-i18n';

const createWorkbenchDataSet = async () =>
createEmptyDataSet<Dataset>(
Expand Down
Expand Up @@ -72,7 +72,7 @@ type DataSetMetaProps = {
export function WbDataSetMeta(
props: Omit<
DataSetMetaProps,
'datasetUrl' | 'onChange' | 'permissionResource' | 'deleteDescription'
'datasetUrl' | 'deleteDescription' | 'onChange' | 'permissionResource'
> & {
readonly onChange: ({
name,
Expand All @@ -88,6 +88,7 @@ export function WbDataSetMeta(
<DataSetMeta
{...props}
datasetUrl="/api/workbench/dataset/"
deleteDescription={wbText.deleteDataSetDescription()}
permissionResource="/workbench/dataset"
onChange={({ needsSaved, name, remarks }) =>
loading(
Expand All @@ -97,7 +98,6 @@ export function WbDataSetMeta(
).then(props.onChange)
)
}
deleteDescription={wbText.deleteDataSetDescription()}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion specifyweb/frontend/js_src/lib/utils/fieldFormat.ts
Expand Up @@ -97,7 +97,7 @@ export function syncFieldFormat<STRICT extends boolean = false>(
value: boolean | number | string | null | undefined,
// @ts-expect-error
strict: STRICT = false
): string | ReturnType<typeof formatValue<STRICT>> {
): ReturnType<typeof formatValue<STRICT>> | string {
if (value === undefined || value === null) return '';
// Find Pick List Item Title
Expand Down

0 comments on commit 825edf1

Please sign in to comment.