Skip to content

Commit

Permalink
version 1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
sereneinserenade committed May 9, 2022
1 parent 4162778 commit 81e7873
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "placenoter",
"version": "1.0.7",
"version": "1.0.8",
"description": "New tab replaced by note taking app.",
"license": "MIT",
"repository": {
Expand Down
21 changes: 18 additions & 3 deletions src/pages/Newtab/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useState } from 'react';
import { Button, Container, Input, Link, Row, Text, Tooltip } from '@nextui-org/react';
import React, { useCallback, useEffect, useState } from 'react';
import { Button, Input, Link, Row, Text, Tooltip } from '@nextui-org/react';
import { useRecoilState, useRecoilValue } from 'recoil';
import { format } from 'date-fns'
import { v4 as uuidv4 } from 'uuid'
Expand All @@ -10,12 +10,13 @@ import { Note } from '../types';
import './css/Sidebar.scss'
import { FiTrash2 } from 'react-icons/fi';
import { RiArrowLeftSLine, RiDeleteBin2Line, RiRecycleLine } from 'react-icons/ri';
import { useLocalStorage } from 'react-use';
// import { toast } from 'react-toastify';

const { storage } = chrome

const Sidebar = () => {
const sidebarActive = useRecoilValue(sidebarActiveState)
const [sidebarActive, setSidebarActive] = useRecoilState(sidebarActiveState)

const [activeNote, setActiveNote] = useRecoilState(activeNoteState)

Expand All @@ -27,6 +28,20 @@ const Sidebar = () => {

const [isBinActive, setIsBinActive] = useState(false)

const [isSidebarOpen, setIsSidebarOpen, remove] = useLocalStorage('sidebar-active', 'false');

useEffect(() => {
setTimeout(() => {
if (isSidebarOpen === 'true') setSidebarActive(true)
else if (isSidebarOpen === 'false') setSidebarActive(false)
}, 100);
}, [])

useEffect(() => {
if (sidebarActive) setIsSidebarOpen('true')
else setIsSidebarOpen('false')
}, [sidebarActive])

const returnFormattedDateString = (timestamp: Date) => {
return format(new Date(timestamp), 'PPpp')
}
Expand Down

0 comments on commit 81e7873

Please sign in to comment.