diff --git a/backend/app/data/__init__.py b/backend/app/data/__init__.py index 402e91d..129ac66 100644 --- a/backend/app/data/__init__.py +++ b/backend/app/data/__init__.py @@ -3,10 +3,9 @@ import logging import os import yaml from .utils import (get_category_directory, load_yaml_file, validate, - save_yaml_file, update_yaml_file, get_file_created_date, - get_file_modified_date, test_regex_pattern, - test_format_conditions, check_delete_constraints, - filename_to_display) + save_yaml_file, update_yaml_file, get_file_modified_date, + test_regex_pattern, test_format_conditions, + check_delete_constraints, filename_to_display) logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) @@ -34,8 +33,6 @@ def retrieve_all(category): file_name, "content": content, - "created_date": - get_file_created_date(file_path), "modified_date": get_file_modified_date(file_path) }) @@ -77,8 +74,6 @@ def handle_item(category, name): file_name, "content": content, - "created_date": - get_file_created_date(file_path), "modified_date": get_file_modified_date(file_path) }), 200 diff --git a/backend/app/data/utils.py b/backend/app/data/utils.py index a0dd1a9..27233e4 100644 --- a/backend/app/data/utils.py +++ b/backend/app/data/utils.py @@ -67,16 +67,6 @@ def _setup_yaml_quotes(): yaml.add_representer(str, str_presenter) -def get_file_created_date(file_path: str) -> str: - """Get file creation date in ISO format""" - try: - stats = os.stat(file_path) - return datetime.fromtimestamp(stats.st_ctime).isoformat() - except Exception as e: - logger.error(f"Error getting creation date for {file_path}: {e}") - return None - - def get_file_modified_date(file_path: str) -> str: """Get file last modified date in ISO format""" try: diff --git a/frontend/src/components/ui/SortMenu.jsx b/frontend/src/components/ui/SortMenu.jsx index f7b6efb..42d12ae 100644 --- a/frontend/src/components/ui/SortMenu.jsx +++ b/frontend/src/components/ui/SortMenu.jsx @@ -1,70 +1,86 @@ // SortMenu.jsx -import { useState, useRef, useEffect } from 'react'; +import {useState, useRef, useEffect} from 'react'; import PropTypes from 'prop-types'; -function SortMenu({ sortBy, setSortBy }) { - const [isOpen, setIsOpen] = useState(false); - const dropdownRef = useRef(null); +function SortMenu({sortBy, setSortBy}) { + const [isOpen, setIsOpen] = useState(false); + const dropdownRef = useRef(null); - const options = [ - { value: 'title', label: 'Sort by Title' }, - { value: 'dateCreated', label: 'Sort by Date Created' }, - { value: 'dateModified', label: 'Sort by Date Modified' }, - ]; + const options = [ + {value: 'title', label: 'Sort by Title'}, + {value: 'dateModified', label: 'Sort by Date Modified'} + ]; - useEffect(() => { - function handleClickOutside(event) { - if (dropdownRef.current && !dropdownRef.current.contains(event.target)) { - setIsOpen(false); - } - } - document.addEventListener('mousedown', handleClickOutside); - return () => document.removeEventListener('mousedown', handleClickOutside); - }, []); + useEffect(() => { + function handleClickOutside(event) { + if ( + dropdownRef.current && + !dropdownRef.current.contains(event.target) + ) { + setIsOpen(false); + } + } + document.addEventListener('mousedown', handleClickOutside); + return () => + document.removeEventListener('mousedown', handleClickOutside); + }, []); - return ( -