Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Feb 16, 2024
1 parent cac1fcc commit 78fc196
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
7 changes: 5 additions & 2 deletions web/src/components/elements/MyAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ type MyAutocompleteProps = Omit<AutocompleteProps, "children"> & {
items: { id: UniqueIdentifier | number; name: string }[];
};

export const MyAutocomplete: React.FC<MyAutocompleteProps> = (props) => {
export const MyAutocomplete: React.FC<MyAutocompleteProps> = ({
items,
...props
}) => {
return (
<Autocomplete
{...props}
name={props.label}
defaultItems={props.items}
defaultItems={items}
// selectedKey={`${props.value}`}
aria-labelledby={props.label}
onSelectionChange={props.onSelectionChange} // key
Expand Down
8 changes: 1 addition & 7 deletions web/src/components/pages/dashboard/table/DroppableItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MyAutocomplete } from "@/components/elements/MyAutocomplete";
import { useMeHook } from "@/components/hooks/useMeHook";
import { useMealHook } from "@/components/hooks/useMealHook";
import { useWeeklyMealGroupHook } from "@/components/hooks/useWeeklyMealGroupHook";
Expand All @@ -8,7 +9,6 @@ import { UniqueIdentifier, useDroppable } from "@dnd-kit/core";
import { useTranslations } from "next-intl";
import { useState } from "react";
import { useSnapshot } from "valtio";
import { MyAutocomplete } from "../../../elements/MyAutocomplete";
import { TableMealItem } from "./TableMealItem";

interface DroppableItemProps {
Expand Down Expand Up @@ -54,15 +54,9 @@ export const DroppableItem: React.FC<DroppableItemProps> = ({
>
{isHighRank && !isOrderMenu && !isPast(date) && (
<MyAutocomplete
id={id}
size="sm"
label={t("SELECT_MEAL")}
isClearable={false}
items={meals || []}
value={value}
onInputChange={(value) => {
setValue(value);
}}
onSelectionChange={async (key) => {
console.log(key);
try {
Expand Down
7 changes: 1 addition & 6 deletions web/src/components/pages/dashboard/table/TableContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
} from "@dnd-kit/sortable";
import dayjs from "dayjs";
import { useTranslations } from "next-intl";
import { title } from "process";
import { useSnapshot } from "valtio";
import { CopyTableWeek } from "./CopyTableWeek";
import { TableGroupRow } from "./TableGroupRow";
Expand All @@ -33,11 +32,7 @@ const RenderDayColumn: React.FC<RenderDayColumnProps> = (props) => {
);
const text = `${props.dayKey.at(0)?.toUpperCase()}${props.dayKey.at(1)}. ${date}`;

return (
<div key={props.dayKey} title={title}>
{text}
</div>
);
return <div key={props.dayKey}>{text}</div>;
};

export function TableContext() {
Expand Down

0 comments on commit 78fc196

Please sign in to comment.