Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmonsen committed Dec 16, 2024
1 parent c8d95ad commit 92202dc
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/features/files-container/files-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ import {Folder} from 'lucide-react';
import {useTrokkFiles} from '../../context/trokk-files-context.tsx';
import DetailedImageView from '../detailed-image-view/detailed-image-view.tsx';
import Thumbnail from '../thumbnail/thumbnail.tsx';
import {FileTree} from '../../model/file-tree.ts';

const FilesContainer: React.FC = () => {
const { state, dispatch } = useTrokkFiles();
const [selectedImgSrc, setselectedImgSrc] = React.useState<string | undefined>(undefined);

const handleDispatch = (child: FileTree) => {
dispatch({ type: 'SET_CURRENT_AND_EXPAND_PARENTS', payload: child });
setselectedImgSrc(undefined);
};

useEffect(() => {
setselectedImgSrc(undefined);
}, [state.current]);
Expand All @@ -40,7 +34,7 @@ const FilesContainer: React.FC = () => {
<button
key={child.path}
className="max-w-[150px]"
onClick={() => handleDispatch(child)}
onClick={() => dispatch({ type: 'SET_CURRENT_AND_EXPAND_PARENTS', payload: child })}
>
<Folder size="96" />
<i>{child.name}</i>
Expand Down

0 comments on commit 92202dc

Please sign in to comment.