diff --git a/src/pages/popup/components/home/Home.tsx b/src/pages/popup/components/home/Home.tsx index 2dc4f74..8aa2700 100644 --- a/src/pages/popup/components/home/Home.tsx +++ b/src/pages/popup/components/home/Home.tsx @@ -1,11 +1,12 @@ import React, { useState, useEffect, useLayoutEffect } from 'react'; import icon from '@assets/img/icon.svg'; import TopComponent from '@pages/popup/components/home/top/Top'; -import MaskedEmailListPane from '@pages/popup/components/home/emails/MaskedEmailListPane'; -import MaskedEmailDetailPane from '@pages/popup/components/home/emails/MaskedEmailDetailPane'; +import MaskedEmailListPane from '@pages/popup/components/home/emailListPane/MaskedEmailListPane'; +import MaskedEmailDetailPane from '@pages/popup/components/home/emailListPane/MaskedEmailDetailPane'; import { list, MaskedEmail } from 'fastmail-masked-email'; import { FASTMAIL_API_TOKEN } from '../../../../../utils/constants'; import PopupProps from '@pages/popup/Popup'; +import LoadingComponent from '@pages/popup/components/home/emailListPane/Loading'; interface HomeComponentProps { maskedEmails: MaskedEmail[]; @@ -13,6 +14,7 @@ interface HomeComponentProps { export default function HomeComponent() { const [maskedEmails, setMaskedEmails] = useState([]); + const [isLoading, setIsLoading] = useState(true); useEffect(() => { const fetchMaskedEmails = async () => { try { @@ -20,6 +22,7 @@ export default function HomeComponent() { const session = storageData.fastmail_session; const allMaskedEmails: MaskedEmail[] = await list(session); setMaskedEmails(allMaskedEmails); + setIsLoading(false); } catch (error) { console.error('Error fetching masked emails:', error); } @@ -34,7 +37,11 @@ export default function HomeComponent() {
- + {isLoading ? ( + + ) : ( + + )}
diff --git a/src/pages/popup/components/home/emailListPane/Loading.tsx b/src/pages/popup/components/home/emailListPane/Loading.tsx new file mode 100644 index 0000000..108a77a --- /dev/null +++ b/src/pages/popup/components/home/emailListPane/Loading.tsx @@ -0,0 +1,27 @@ +import React from 'react'; + +const LoadingComponent = () => ( +
+
+ + Loading... +
+
+); + +export default LoadingComponent; diff --git a/src/pages/popup/components/home/emails/MaskedEmailDetailPane.tsx b/src/pages/popup/components/home/emailListPane/MaskedEmailDetailPane.tsx similarity index 100% rename from src/pages/popup/components/home/emails/MaskedEmailDetailPane.tsx rename to src/pages/popup/components/home/emailListPane/MaskedEmailDetailPane.tsx diff --git a/src/pages/popup/components/home/emails/MaskedEmailListItem.tsx b/src/pages/popup/components/home/emailListPane/MaskedEmailListItem.tsx similarity index 100% rename from src/pages/popup/components/home/emails/MaskedEmailListItem.tsx rename to src/pages/popup/components/home/emailListPane/MaskedEmailListItem.tsx diff --git a/src/pages/popup/components/home/emails/MaskedEmailListPane.tsx b/src/pages/popup/components/home/emailListPane/MaskedEmailListPane.tsx similarity index 94% rename from src/pages/popup/components/home/emails/MaskedEmailListPane.tsx rename to src/pages/popup/components/home/emailListPane/MaskedEmailListPane.tsx index b0376fe..4d8909b 100644 --- a/src/pages/popup/components/home/emails/MaskedEmailListPane.tsx +++ b/src/pages/popup/components/home/emailListPane/MaskedEmailListPane.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { MaskedEmail } from 'fastmail-masked-email'; -import MaskedEmailListItem from '@pages/popup/components/home/emails/MaskedEmailListItem'; +import MaskedEmailListItem from '@pages/popup/components/home/emailListPane/MaskedEmailListItem'; interface Props { maskedEmails: MaskedEmail[]; diff --git a/tailwind.config.cjs b/tailwind.config.cjs index b23ed6e..3afadb3 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -3,7 +3,10 @@ module.exports = { theme: { extend: { animation: { - 'spin-slow': 'spin 20s linear infinite', + 'spin-slow': 'spin 2s linear infinite', + 'spin-fast': 'spin 0.5s linear infinite', + 'spin-default': 'spin 1s linear infinite', + }, colors: { 'magnesium': '#B3B3B3',