* Move frontend to root * Fix backend issues * Remove old routes * Setup Dockerfile * Fix today /tags multiplt requests issue * Fix race condition on today's inbox widget * Fix cors development issue * Fix CORS for Dockerfile * Fix dockerised settings for infinite loop * Fix translation issues * fixup! Fix translation issues --------- Co-authored-by: Your Name <you@example.com>
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
import { Location } from 'react-router-dom';
|
|
import { BookOpenIcon, PlusCircleIcon } from '@heroicons/react/24/outline';
|
|
import { Note } from '../../entities/Note';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
interface SidebarNotesProps {
|
|
handleNavClick: (path: string, title: string, icon: JSX.Element) => void;
|
|
location: Location;
|
|
isDarkMode: boolean;
|
|
openNoteModal: (note: Note | null) => void;
|
|
notes: Note[];
|
|
}
|
|
|
|
const SidebarNotes: React.FC<SidebarNotesProps> = ({
|
|
handleNavClick,
|
|
location,
|
|
openNoteModal,
|
|
}) => {
|
|
const { t } = useTranslation();
|
|
const isActiveNote = (path: string) => {
|
|
return location.pathname === path
|
|
? 'bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-white'
|
|
: 'text-gray-700 dark:text-gray-300';
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<ul className="flex flex-col space-y-1">
|
|
<li
|
|
className={`flex justify-between items-center rounded-md px-4 py-2 uppercase text-xs tracking-wider cursor-pointer hover:text-black dark:hover:text-white ${isActiveNote(
|
|
'/notes'
|
|
)}`}
|
|
onClick={() => handleNavClick('/notes', 'Notes', <BookOpenIcon className="h-5 w-5 mr-2" />)}
|
|
>
|
|
<span className="flex items-center">
|
|
<BookOpenIcon className="h-5 w-5 mr-2" />
|
|
{t('sidebar.notes')}
|
|
</span>
|
|
<button
|
|
onClick={(e) => {
|
|
e.stopPropagation();
|
|
openNoteModal(null);
|
|
}}
|
|
className="text-gray-700 dark:text-gray-300 hover:text-black dark:hover:text-white focus:outline-none"
|
|
aria-label="Add Note"
|
|
title="Add Note"
|
|
>
|
|
<PlusCircleIcon className="h-5 w-5" />
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default SidebarNotes;
|