diff --git a/ao3 webpages/components/Login.jsx b/ao3 webpages/components/Login.jsx index 6bbf87b..6ed3301 100644 --- a/ao3 webpages/components/Login.jsx +++ b/ao3 webpages/components/Login.jsx @@ -73,12 +73,19 @@ export default function Login() { // Store tokens in localStorage localStorage.setItem('accessToken', data.accessToken); localStorage.setItem('refreshToken', data.refreshToken); - - // Send token to Chrome extension - chrome.runtime.sendMessage("nnmmeljlhmhpnfphcpifdahblfmhlilm", { action: "storeToken", token: data.refreshToken }, function(response) { - console.log('Token sent to extension'); + + // Send both tokens to the Chrome extension + chrome.runtime.sendMessage("nnmmeljlhmhpnfphcpifdahblfmhlilm", + { action: "storeTokens", accessToken: data.accessToken, refreshToken: data.refreshToken }, + function(response) { + if (chrome.runtime.lastError) { + console.error('Error sending message:', chrome.runtime.lastError); + } else { + console.log('Tokens sent to extension:', response); + } }); - + + setMessage('Login successful'); setMessageType('success'); @@ -227,7 +234,7 @@ return ( borderRadius: '4px', fontSize: '16px', cursor: 'pointer', - marginTop: '50px' + marginTop: '25px' }} > diff --git a/ao3 webpages/src/pages/notes.jsx b/ao3 webpages/src/pages/notes.jsx index cb043f8..afab2c9 100644 --- a/ao3 webpages/src/pages/notes.jsx +++ b/ao3 webpages/src/pages/notes.jsx @@ -1,10 +1,11 @@ import { useState, useRef, useEffect } from 'react' import Sidebar from '../../components/Sidebar/Sidebar'; + const initialNotes = [ { id: '1', title: 'The Shoebox Project', tags: ['Humor', 'Drama'], completed: false }, { id: '2', title: 'Twist and Shout', tags: ['Angst', 'Historical', 'Tragedy'], completed: false }, { id: '3', title: 'Everyday Love in Stockholm', tags: ['Humor', 'Hurt', 'Loki'], completed: false }, - { id: '4', title: 'Everyday Love in Stockholm', tags: ['Humor', 'Hurt', 'Loki'], completed: false }, + { id: '4', title: 'The Shoebox Project', tags: ['Humor', 'Drama'], completed: false }, { id: '5', title: 'Crying Lightning', tags: ['Angst', 'Skugrou'], completed: false }, { id: '6', title: 'The Shoebox Project', tags: ['Humor', 'Drama'], completed: true }, ] @@ -53,7 +54,7 @@ export default function Component() { if (value.endsWith(' ') && value.trim() !== '') { setNewNote(prev => ({ ...prev, - tags: [...prev.tags, currentTag.trim()] + tags: [...prev.tags, value.trim()] })) setCurrentTag('') } else { @@ -92,16 +93,11 @@ export default function Component() { } const sortedNotes = [...notes].sort((a, b) => { - const aMatchCount = a.tags.filter(tag => - selectedTags.includes(tag) || tag.toLowerCase().includes(searchTag.toLowerCase()) - ).length - const bMatchCount = b.tags.filter(tag => - selectedTags.includes(tag) || tag.toLowerCase().includes(searchTag.toLowerCase()) - ).length + const aMatchCount = a.tags.filter(tag => selectedTags.includes(tag)).length + const bMatchCount = b.tags.filter(tag => selectedTags.includes(tag)).length if (aMatchCount !== bMatchCount) { - return bMatchCount - aMatchCount // Sort by match count first + return bMatchCount - aMatchCount } - // If match counts are equal, maintain original order return notes.indexOf(a) - notes.indexOf(b) }) @@ -109,138 +105,149 @@ export default function Component() { return sortedNotes .filter(note => note.completed === completed) .map(note => ( -
+ {note.tags.map(tag => ( + + #{tag} + + ))} +
- {note.tags.map(tag => ( - - #{tag} - - ))} -
+#Add Tags
-