update build ok,

This commit is contained in:
louiscklaw
2025-04-22 18:53:17 +08:00
parent f87dd2c3b1
commit 64b5f89fdf
30 changed files with 232 additions and 35 deletions

View File

@@ -5,10 +5,9 @@ import { useRouter } from 'next/navigation';
// import { COL_LESSON_CATEGORIES } from '@/constants';
// RULES: Quiz
import GetAllCount from '@/db/QuizListenings/GetAllCount';
import GetHiddenCount from '@/db/QuizListenings/GetHiddenCount';
// import GetVisibleCount from '@/db/QuizListenings/GetVisibleCount';
// import GetVisibleCount from '@/db/Q';
import GetAllCount from '@/db/QuizMFCategories/GetAllCount';
import GetHiddenCount from '@/db/QuizMFCategories/GetHiddenCount';
import GetVisibleCount from '@/db/QuizMFCategories/GetVisibleCount';
//
import Button from '@mui/material/Button';
import Chip from '@mui/material/Chip';
@@ -28,7 +27,7 @@ import { FilterButton, FilterPopover, useFilterContext } from '@/components/core
import { Option } from '@/components/core/option';
import { useCrCategoriesSelection } from './cr-categories-selection-context';
import { CrCategory } from './type';
import type { CrCategory } from './type';
export interface Filters {
email?: string;

View File

@@ -23,7 +23,7 @@ import { paths } from '@/paths';
import { FilterButton, FilterPopover, useFilterContext } from '@/components/core/filter-button';
import { Option } from '@/components/core/option';
import { useLpQuestionsSelection } from './cr-questions-selection-context';
import { useCrQuestionsSelection } from './cr-questions-selection-context';
import { CrQuestion } from './type';
export interface Filters {
@@ -57,7 +57,7 @@ export function CrQuestionsFilters({
const router = useRouter();
const selection = useLpQuestionsSelection();
const selection = useCrQuestionsSelection();
function getVisible(): number {
return fullData.reduce((count, item: CrQuestion) => {

View File

@@ -12,9 +12,9 @@ function noop(): void {
return undefined;
}
export interface LpQuestionsSelectionContextValue extends Selection {}
export interface CrQuestionsSelectionContextValue extends Selection {}
export const LpQuestionsSelectionContext = React.createContext<LpQuestionsSelectionContextValue>({
export const CrQuestionsSelectionContext = React.createContext<CrQuestionsSelectionContextValue>({
deselectAll: noop,
deselectOne: noop,
selectAll: noop,
@@ -24,7 +24,7 @@ export const LpQuestionsSelectionContext = React.createContext<LpQuestionsSelect
selectedAll: false,
});
interface LpQuestionsSelectionProviderProps {
interface CrQuestionsSelectionProviderProps {
children: React.ReactNode;
lessonQuestions: CrQuestion[];
}
@@ -32,15 +32,15 @@ interface LpQuestionsSelectionProviderProps {
export function CrQuestionsSelectionProvider({
children,
lessonQuestions = [],
}: LpQuestionsSelectionProviderProps): React.JSX.Element {
}: CrQuestionsSelectionProviderProps): React.JSX.Element {
const customerIds = React.useMemo(() => lessonQuestions.map((customer) => customer.id), [lessonQuestions]);
const selection = useSelection(customerIds);
return (
<LpQuestionsSelectionContext.Provider value={{ ...selection }}>{children}</LpQuestionsSelectionContext.Provider>
<CrQuestionsSelectionContext.Provider value={{ ...selection }}>{children}</CrQuestionsSelectionContext.Provider>
);
}
export function useLpQuestionsSelection(): LpQuestionsSelectionContextValue {
return React.useContext(LpQuestionsSelectionContext);
export function useCrQuestionsSelection(): CrQuestionsSelectionContextValue {
return React.useContext(CrQuestionsSelectionContext);
}

View File

@@ -25,7 +25,7 @@ import { DataTable } from '@/components/core/data-table';
import type { ColumnDef } from '@/components/core/data-table';
import ConfirmDeleteModal from './confirm-delete-modal';
import { useLpQuestionsSelection } from './cr-questions-selection-context';
import { useCrQuestionsSelection } from './cr-questions-selection-context';
import type { CrQuestion } from './type';
function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuestion>[] {
@@ -40,7 +40,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuest
<Link
color="inherit"
component={RouterLink}
href={paths.dashboard.lp_categories.details(row.id)}
href={paths.dashboard.cr_questions.details(row.id)}
sx={{ whiteSpace: 'nowrap' }}
variant="subtitle2"
>
@@ -163,7 +163,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuest
//
color="secondary"
component={RouterLink}
href={paths.dashboard.lp_categories.details(row.id)}
href={paths.dashboard.cr_questions.details(row.id)}
>
<PencilSimpleIcon size={24} />
</LoadingButton>
@@ -193,7 +193,7 @@ export interface LessonQuestionsTableProps {
export function CrQuestionsTable({ rows, reloadRows }: LessonQuestionsTableProps): React.JSX.Element {
const { t } = useTranslation(['lp_categories']);
const { deselectAll, deselectOne, selectAll, selectOne, selected } = useLpQuestionsSelection();
const { deselectAll, deselectOne, selectAll, selectOne, selected } = useCrQuestionsSelection();
const [idToDelete, setIdToDelete] = React.useState('');
const [open, setOpen] = React.useState(false);