From 49dcf4e0b72053a8c0feb5983a0f5eec663832c4 Mon Sep 17 00:00:00 2001
From: buchananwill <139961977+buchananwill@users.noreply.github.com>
Date: Fri, 29 Mar 2024 23:30:25 +0000
Subject: [PATCH] Changing every btn to Button.
---
app/build-metrics/[schedule]/page.tsx | 55 +++++++++++--------
.../class-hierarchy/[yearGroup]/page.tsx | 2 +-
.../[yearGroup]/bundles/bundle-editor.tsx | 16 ++++--
.../[yearGroup]/bundles/page.tsx | 2 +-
.../add-new-curriculum-model-card.tsx | 19 ++++---
.../curriculum-delivery-model.tsx | 19 +++----
app/generic/components/buttons/pagination.tsx | 16 +++++-
.../components/buttons/two-stage-click.tsx | 20 ++++---
.../calendar/range/choose-calendar-range.tsx | 37 +++++++------
.../disclosure-that-grows-open.tsx | 9 +--
.../components/dropdown/filter-dropdown.tsx | 1 -
.../components/dropdown/tuple-selector.tsx | 12 ++--
.../components/overlays/deleted-overlay.tsx | 13 +++--
.../selective-context-range-slider.tsx | 21 ++++---
.../components/tab-layouts/tab-styled.tsx | 16 ++++--
.../components/tables/big-table-card.tsx | 2 +-
.../rating/rated-element-row-header.tsx | 10 ++--
.../tool-card/right-hand-tool-card.tsx | 2 +-
.../components/tool-card/tool-card.tsx | 2 +-
.../components/graph-view-options.tsx | 9 +--
.../components/node-detail-wrapper.tsx | 43 ++++++++-------
.../curriculum-delivery-graph.tsx | 2 +-
app/navbar/protected-navigation.tsx | 20 +++----
app/playground/page.tsx | 2 +-
.../some-button-to-control-gary.tsx | 6 +-
.../apply-search-params.tsx | 1 -
.../asset-suitability-table-wrapper.tsx | 2 +-
app/premises/classroom-suitability/page.tsx | 2 +-
.../search-params-filter-group.tsx | 2 +-
.../add-teacher-form/add-teacher-form.tsx | 17 +++---
.../teachers/skills/skill-table-wrapper.tsx | 2 +-
.../color-context-button.tsx | 14 +++--
.../knowledge-domain-dependencies.tsx | 8 +--
.../knowledge-domain-name-cell.tsx | 5 +-
.../knowledge-domain-table-editor.tsx | 4 +-
.../new-knowledge-domain-button.tsx | 21 ++++---
.../knowledge-level-dependencies.tsx | 8 +--
.../knowledge-level-name-cell.tsx | 5 +-
.../knowledge-level-table-editor.tsx | 2 +-
.../new-knowledge-level-button.tsx | 9 ++-
.../[schedule]/data-not-found-card.tsx | 4 +-
tailwind.config.ts | 2 +-
42 files changed, 266 insertions(+), 198 deletions(-)
diff --git a/app/build-metrics/[schedule]/page.tsx b/app/build-metrics/[schedule]/page.tsx
index 3d7697a..09f2a86 100644
--- a/app/build-metrics/[schedule]/page.tsx
+++ b/app/build-metrics/[schedule]/page.tsx
@@ -1,4 +1,5 @@
-import { Button, Card, Text, Title } from '@tremor/react';
+import { Button, Text, Title } from '@tremor/react';
+import { Card, CardBody } from '@nextui-org/react';
import { BuildMetricsChart } from './buildMetricsChart';
import MetricsContextProvider from './metrics-context-provider';
@@ -27,34 +28,40 @@ export default async function BuildMetricsOverview({
const buildMetricDto = buildMetricDtoResponse.data;
if (buildMetricDto === undefined) {
console.log(buildMetricDtoResponse.message);
- return No data found!;
+ return (
+
+ No data found!
+
+ );
}
return (
-
-
- Build Metric Overview, Schedule {scheduleId}
-
-
-
-
-
-
-
- Total allocation loops: {buildMetricDto.totalAllocationLoops}
-
- Final State: {buildMetricDto.finalState}
-
+
+
+
+ Build Metric Overview, Schedule {scheduleId}
+
+
+
+
+
+
+
+ Total allocation loops: {buildMetricDto.totalAllocationLoops}
+
+ Final State: {buildMetricDto.finalState}
+
+
);
diff --git a/app/curriculum/class-hierarchy/[yearGroup]/page.tsx b/app/curriculum/class-hierarchy/[yearGroup]/page.tsx
index f135e71..0e3cc55 100644
--- a/app/curriculum/class-hierarchy/[yearGroup]/page.tsx
+++ b/app/curriculum/class-hierarchy/[yearGroup]/page.tsx
@@ -4,7 +4,7 @@ import {
getOrganizationGraphByOrganizationType,
getSchemasByIdList
} from '../../../api/actions/curriculum-delivery-model';
-import { Card } from '@tremor/react';
+import { Card } from '@nextui-org/react';
import ForceGraphPage from '../../../graphing/force-graph-page';
diff --git a/app/curriculum/delivery-models/[yearGroup]/bundles/bundle-editor.tsx b/app/curriculum/delivery-models/[yearGroup]/bundles/bundle-editor.tsx
index ec449e5..db6a685 100644
--- a/app/curriculum/delivery-models/[yearGroup]/bundles/bundle-editor.tsx
+++ b/app/curriculum/delivery-models/[yearGroup]/bundles/bundle-editor.tsx
@@ -39,6 +39,7 @@ import {
UnsavedBundleEdits
} from '../../../../selective-context/keys/work-series-schema-bundle-keys';
import { RenameModalWrapperContextKey } from '../../../../selective-context/keys/modal-keys';
+import { Button } from '@nextui-org/react';
function bundleSort(
bun1: WorkSeriesSchemaBundleLeanDto,
@@ -215,11 +216,11 @@ export function BundleEditor({
Current Tab:
- deleteBundle(activeBundleAndId.id)}>
+ deleteBundle(activeBundleAndId.id)}>
@@ -258,12 +259,15 @@ export function BundleEditor({
-
+
{sortedBundleList.map(({ id }, index) => (
diff --git a/app/curriculum/delivery-models/[yearGroup]/bundles/page.tsx b/app/curriculum/delivery-models/[yearGroup]/bundles/page.tsx
index 4bbc471..9bb52fb 100644
--- a/app/curriculum/delivery-models/[yearGroup]/bundles/page.tsx
+++ b/app/curriculum/delivery-models/[yearGroup]/bundles/page.tsx
@@ -3,7 +3,7 @@ import {
getCurriculumDeliveryModelSchemasByKnowledgeLevel
} from '../../../../api/actions/curriculum-delivery-model';
import { normalizeQueryParamToNumber } from '../../../../api/utils';
-import { Card } from '@tremor/react';
+import { Card } from '@nextui-org/react';
import { BundleEditor } from './bundle-editor';
import { BundleItemsContextProvider } from '../../contexts/bundle-items-context-provider';
import { BundleAssignmentsProvider } from '../../contexts/bundle-assignments-provider';
diff --git a/app/curriculum/delivery-models/add-new-curriculum-model-card.tsx b/app/curriculum/delivery-models/add-new-curriculum-model-card.tsx
index f566e7a..06eee38 100644
--- a/app/curriculum/delivery-models/add-new-curriculum-model-card.tsx
+++ b/app/curriculum/delivery-models/add-new-curriculum-model-card.tsx
@@ -1,5 +1,5 @@
'use client';
-import { Card } from '@tremor/react';
+import { Button, Card } from '@nextui-org/react';
import { PlusCircleIcon } from '@heroicons/react/24/outline';
import React, { useMemo, useState } from 'react';
@@ -28,6 +28,7 @@ import {
useModal
} from '../../generic/components/modals/confirm-action-modal';
import TupleSelector from '../../generic/components/dropdown/tuple-selector';
+import { isNotNull } from '../../api/main';
const noTaskType: NameIdStringTuple = { name: 'No Type Selected', id: 'n/a' };
@@ -55,7 +56,8 @@ export function AddNewCurriculumModelCard({
const { isOpen, closeModal, openModal } = useModal();
const { workTaskTypeMap } = useWorkTaskTypeContext();
const { dispatch, curriculumModelsMap } = useCurriculumModelContext();
- const [newModelTaskType, setNewModelTaskType] = useState(noTaskType);
+ const [newModelTaskType, setNewModelTaskType] =
+ useState(null);
const [nextModelId, setNextModelId] = useState(crypto.randomUUID());
const [revertUnsaved, setRevertUnsaved] = useState(true);
const appRouterInstance = useRouter();
@@ -99,12 +101,13 @@ export function AddNewCurriculumModelCard({
}
setNextModelId(crypto.randomUUID());
setNewModelTaskType(
- taskTypeSelectionList.length > 0 ? taskTypeSelectionList[0] : noTaskType
+ taskTypeSelectionList.length > 0 ? taskTypeSelectionList[0] : null
);
closeModal();
};
const handleAddNewModel = () => {
+ if (!isNotNull(newModelTaskType)) return;
const unsavedModel: WorkProjectSeriesSchemaDto = {
...curriculumModelsMap[nextModelId],
id: nextModelId,
@@ -129,12 +132,14 @@ export function AddNewCurriculumModelCard({
return (
<>
-
+
-
+
{' '}
-
+
Periods
diff --git a/app/generic/components/buttons/pagination.tsx b/app/generic/components/buttons/pagination.tsx
index dc06f46..fd8962e 100644
--- a/app/generic/components/buttons/pagination.tsx
+++ b/app/generic/components/buttons/pagination.tsx
@@ -10,7 +10,9 @@ import { useEffect, useState, useTransition } from 'react';
import ProtectedNavigation from '../../../navbar/protected-navigation';
import { zeroIndexToOneIndex } from '../../../api/utils';
-const buttonClassName = 'btn relative btn-primary btn-outline';
+import { ButtonProps } from '@nextui-org/react';
+const buttonClassName = ' relative ';
+
const svgClassName = 'h-5 w-5 ';
/**
@@ -72,6 +74,9 @@ export function Pagination({
{!!lastPage && (
)}
handleClick(false)}
@@ -95,6 +103,9 @@ export function Pagination({
handleClick(true)}
disabled={last || pending}
@@ -106,6 +117,9 @@ export function Pagination({
{!!lastPage && (
(undefined);
const { refs, floatingStyles } = useFloating({
@@ -24,9 +26,9 @@ export function TwoStageClick({
middleware: [offset({ mainAxis: 10 })]
});
- const guardClick = (e: React.MouseEvent) => {
- if (clickPrimed && onClick) {
- onClick(e);
+ const guardClick = (e: PressEvent) => {
+ if (clickPrimed && isNotUndefined(onPress)) {
+ onPress(e);
setClickPrimed(false);
if (timeoutRef.current !== undefined) clearTimeout(timeoutRef.current);
} else {
@@ -43,7 +45,7 @@ export function TwoStageClick({
color={clickPrimed ? primedAppearance : 'default'}
variant={standardAppearance}
size={'sm'}
- onClick={guardClick}
+ onPress={guardClick}
>
{children}
@@ -51,9 +53,9 @@ export function TwoStageClick({
-
+
{primedMessage}
diff --git a/app/generic/components/calendar/range/choose-calendar-range.tsx b/app/generic/components/calendar/range/choose-calendar-range.tsx
index 1370cce..4341a4f 100644
--- a/app/generic/components/calendar/range/choose-calendar-range.tsx
+++ b/app/generic/components/calendar/range/choose-calendar-range.tsx
@@ -17,6 +17,7 @@ import { ChevronLeftIcon } from '@heroicons/react/24/solid';
import ZoomBothAxes from '../../zoom/zoom-both-axes';
import { Tooltip, TooltipTrigger } from '../../tooltips/tooltip';
import { StandardTooltipContent } from '../../tooltips/standard-tooltip-content';
+import { Button } from '@nextui-org/react';
type TooltipOptions =
| 'minusWeek'
| 'minusDay'
@@ -87,21 +88,23 @@ export function ChooseCalendarRange() {
-
- handleRangeUpdate(-1)}
+ handleRangeUpdate(-1)}
>
Day
-
+
@@ -124,20 +127,22 @@ export function ChooseCalendarRange() {
- handleRangeUpdate(1)}
+ handleRangeUpdate(1)}
>
Day
-
+
- handleRangeUpdate(7)}
+ handleRangeUpdate(7)}
>
Week
-
+
diff --git a/app/generic/components/disclosures/disclosure-that-grows-open.tsx b/app/generic/components/disclosures/disclosure-that-grows-open.tsx
index 105b9e3..71e153b 100644
--- a/app/generic/components/disclosures/disclosure-that-grows-open.tsx
+++ b/app/generic/components/disclosures/disclosure-that-grows-open.tsx
@@ -1,5 +1,6 @@
import { ChevronDownIcon } from '@heroicons/react/20/solid';
import { PropsWithChildren, useState } from 'react';
+import { Button } from '@nextui-org/react';
export function DisclosureThatGrowsOpen({
children,
@@ -15,9 +16,9 @@ export function DisclosureThatGrowsOpen({
return (
-
setShowSliders(!showSliders)}
+ setShowSliders(!showSliders)}
>
{label}
-
+
;
@@ -62,11 +63,14 @@ export default function TupleSelector({
-
updateSelectedState(null)}
+ onPress={() => updateSelectedState(null)}
disabled={!isNotNull(selectedState)}
>
-
+
{show && (
-
-
-
+
+
)}
>
diff --git a/app/generic/components/range-input/selective-context-range-slider.tsx b/app/generic/components/range-input/selective-context-range-slider.tsx
index a1c41b6..65a5652 100644
--- a/app/generic/components/range-input/selective-context-range-slider.tsx
+++ b/app/generic/components/range-input/selective-context-range-slider.tsx
@@ -1,6 +1,7 @@
'use client';
import React from 'react';
import { useSelectiveContextControllerNumber } from '../../../selective-context/components/typed/selective-context-manager-number';
+import { Slider } from '@nextui-org/react';
export function SelectiveContextRangeSlider({
contextKey,
@@ -22,19 +23,25 @@ export function SelectiveContextRangeSlider({
});
return (
- {
+ onChange={(value) => {
+ const singleValue = Array.isArray(value) ? value[0] : value;
+
dispatchUpdate({
contextKey: contextKey,
- value: parseInt(event.target.value)
+ value: singleValue
});
}}
- >
+ >
);
}
diff --git a/app/generic/components/tab-layouts/tab-styled.tsx b/app/generic/components/tab-layouts/tab-styled.tsx
index 3e39f52..26c7326 100644
--- a/app/generic/components/tab-layouts/tab-styled.tsx
+++ b/app/generic/components/tab-layouts/tab-styled.tsx
@@ -1,17 +1,21 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { Tab } from '@headlessui/react';
+import { Button } from '@nextui-org/react';
+import { isFragment } from 'preact/compat';
export function TabStyled({ children }: { children: string }) {
return (
-
- {({ selected }) => (
-
+ {({ selected, ...props }) => (
+
{children}
-
+
)}
);
diff --git a/app/generic/components/tables/big-table-card.tsx b/app/generic/components/tables/big-table-card.tsx
index a34830c..16070f5 100644
--- a/app/generic/components/tables/big-table-card.tsx
+++ b/app/generic/components/tables/big-table-card.tsx
@@ -1,4 +1,4 @@
-import { Card } from '@tremor/react';
+import { Card } from '@nextui-org/react';
import React from 'react';
export default function BigTableCard({
diff --git a/app/generic/components/tables/rating/rated-element-row-header.tsx b/app/generic/components/tables/rating/rated-element-row-header.tsx
index eb706b5..2ba2236 100644
--- a/app/generic/components/tables/rating/rated-element-row-header.tsx
+++ b/app/generic/components/tables/rating/rated-element-row-header.tsx
@@ -7,6 +7,7 @@ import { EmptyArray, isNotUndefined } from '../../../../api/main';
import { useUnsavedListContext } from '../../../../selective-context/hooks/derived/use-unsaved-list-context';
import { RatingStepper } from '../../buttons/rating-stepper';
import { ArrowRightIcon, PencilSquareIcon } from '@heroicons/react/20/solid';
+import { Button } from '@nextui-org/react';
export function RatedElementRowHeader({
elementWithRating
@@ -57,17 +58,18 @@ export function RatedElementRowHeader({
return (
<>
-
+ onPress={() =>
triggerModal({ elementWithRating, rating: currentState[0] })
}
+ // size={'md'}
>
{elementLabelAccessor(elementWithRating)}
-
+
- setShowSliders(!showSliders)}
+ setShowSliders(!showSliders)}
>
View Options
-
+
({
label,
@@ -29,17 +30,18 @@ export function NodeDetailWrapper
({
<>
-
-
handleDispatch()}
- className={'btn border-0 m-0'}
+
+
handleDispatch()}
+ className={'border-0 m-0'}
+ isIconOnly
>
{isSelected ? (
) : (
)}
-
+
-
- {label}
-
-
+
+ {({ open }) => (
+
+
+ {label}
+
+
+
+ )}
);
}
diff --git a/app/graphing/graph-types/organization/curriculum-delivery-graph.tsx b/app/graphing/graph-types/organization/curriculum-delivery-graph.tsx
index 763cb0e..6c3e356 100644
--- a/app/graphing/graph-types/organization/curriculum-delivery-graph.tsx
+++ b/app/graphing/graph-types/organization/curriculum-delivery-graph.tsx
@@ -5,7 +5,7 @@ import {
GraphDtoPutRequestBody
} from '../../../api/zod-mods';
import React, { PropsWithChildren, useEffect, useMemo } from 'react';
-import { Card } from '@tremor/react';
+import { Card } from '@nextui-org/react';
import CurriculumDeliveryDetails from './curriculum-delivery-details';
import { NodePayload } from '../../force-graph-page';
import { WorkSeriesBundleDeliveryDto } from '../../../api/dtos/WorkSeriesBundleDeliveryDtoSchema';
diff --git a/app/navbar/protected-navigation.tsx b/app/navbar/protected-navigation.tsx
index 8150c06..f307882 100644
--- a/app/navbar/protected-navigation.tsx
+++ b/app/navbar/protected-navigation.tsx
@@ -11,14 +11,11 @@ import {
useSelectiveContextDispatchBoolean,
useSelectiveContextListenerBoolean
} from '../selective-context/components/typed/selective-context-manager-boolean';
+import { Button, ButtonProps } from '@nextui-org/react';
const paginationUnsavedListenerKey = ':pagination';
-export interface ProtectedNavigationProps
- extends React.DetailedHTMLProps<
- React.ButtonHTMLAttributes,
- HTMLButtonElement
- > {
+export interface ProtectedNavigationProps extends ButtonProps {
onConfirm: () => void;
children: ReactNode;
isActive?: boolean;
@@ -49,7 +46,8 @@ const ProtectedNavigation = forwardRef<
unsavedContextKey,
unsavedListenerKey: listenerKeyProp,
className,
- disabled
+ disabled,
+ ...buttonProps
} = props;
let [isOpen, setIsOpen] = useState(false);
@@ -86,9 +84,9 @@ const ProtectedNavigation = forwardRef<
return (
<>
- {
@@ -97,10 +95,10 @@ const ProtectedNavigation = forwardRef<
}
className={finalClassNames}
aria-current={isActive ? 'page' : undefined}
- disabled={disabled}
+ isDisabled={disabled}
>
{children}
-
+