Skip to content

Commit

Permalink
chore: tweak load more button
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Aug 12, 2024
1 parent fc2cd43 commit 9a27fdf
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 64 deletions.
5 changes: 1 addition & 4 deletions web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@
"copy-link": "Copy Link",
"count-memos-in-date": "{{count}} memos in {{date}}",
"delete-confirm": "Are you sure you want to delete this memo? THIS ACTION IS IRREVERSIBLE",
"delete-memo": "Delete Memo",
"embed": "Embed",
"fetch-more": "Click to fetch more",
"fetching-data": "Fetching data…",
"load-more": "Load more",
"no-archived-memos": "No archived memos.",
"search-placeholder": "Search memos",
"show-more": "Show more",
Expand Down
30 changes: 15 additions & 15 deletions web/src/pages/Archived.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,25 @@ const Archived = () => {
<MemoContent key={`${memo.name}-${memo.displayTime}`} memoName={memo.name} nodes={memo.nodes} readonly={true} />
</div>
))}
{isRequesting ? (
<div className="flex flex-row justify-center items-center w-full my-4 text-gray-400">
<Icon.Loader className="w-4 h-auto animate-spin mr-1" />
<p className="text-sm italic">{t("memo.fetching-data")}</p>
</div>
) : !nextPageToken ? (
sortedMemos.length === 0 && (
<div className="w-full mt-16 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-4 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)
) : (
{nextPageToken && (
<div className="w-full flex flex-row justify-center items-center my-4">
<Button variant="plain" endDecorator={<Icon.ArrowDown className="w-5 h-auto" />} onClick={() => fetchMemos(nextPageToken)}>
{t("memo.fetch-more")}
<Button
variant="plain"
color="neutral"
loading={isRequesting}
endDecorator={<Icon.ArrowDown className="w-4 h-auto" />}
onClick={() => fetchMemos(nextPageToken)}
>
{t("memo.load-more")}
</Button>
</div>
)}
{!nextPageToken && sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)}
</div>
</div>
</section>
Expand Down
30 changes: 15 additions & 15 deletions web/src/pages/Explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ const Explore = () => {
{sortedMemos.map((memo) => (
<MemoView key={`${memo.name}-${memo.updateTime}`} memo={memo} showCreator showVisibility showPinned compact />
))}
{isRequesting ? (
<div className="flex flex-row justify-center items-center w-full my-4 text-gray-400">
<Icon.Loader className="w-4 h-auto animate-spin mr-1" />
<p className="text-sm italic">{t("memo.fetching-data")}</p>
</div>
) : !nextPageToken ? (
sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)
) : (
{nextPageToken && (
<div className="w-full flex flex-row justify-center items-center my-4">
<Button variant="plain" endDecorator={<Icon.ArrowDown className="w-5 h-auto" />} onClick={() => fetchMemos(nextPageToken)}>
{t("memo.fetch-more")}
<Button
variant="plain"
color="neutral"
loading={isRequesting}
endDecorator={<Icon.ArrowDown className="w-4 h-auto" />}
onClick={() => fetchMemos(nextPageToken)}
>
{t("memo.load-more")}
</Button>
</div>
)}
{!nextPageToken && sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)}
</div>
</div>
{md && (
Expand Down
30 changes: 15 additions & 15 deletions web/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,25 @@ const Home = () => {
{sortedMemos.map((memo) => (
<MemoView key={`${memo.name}-${memo.updateTime}`} memo={memo} showVisibility showPinned compact />
))}
{isRequesting ? (
<div className="flex flex-row justify-center items-center w-full my-4 text-gray-400">
<Icon.Loader className="w-4 h-auto animate-spin mr-1" />
<p className="text-sm italic">{t("memo.fetching-data")}</p>
</div>
) : !nextPageToken ? (
sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)
) : (
{nextPageToken && (
<div className="w-full flex flex-row justify-center items-center my-4">
<Button variant="plain" endDecorator={<Icon.ArrowDown className="w-5 h-auto" />} onClick={() => fetchMemos(nextPageToken)}>
{t("memo.fetch-more")}
<Button
variant="plain"
color="neutral"
loading={isRequesting}
endDecorator={<Icon.ArrowDown className="w-4 h-auto" />}
onClick={() => fetchMemos(nextPageToken)}
>
{t("memo.load-more")}
</Button>
</div>
)}
{!nextPageToken && sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)}
</div>
</div>
{md && (
Expand Down
26 changes: 11 additions & 15 deletions web/src/pages/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,25 @@ const UserProfile = () => {
{sortedMemos.map((memo) => (
<MemoView key={`${memo.name}-${memo.displayTime}`} memo={memo} showVisibility showPinned compact />
))}
{isRequesting ? (
<div className="flex flex-row justify-center items-center w-full my-4 text-gray-400">
<Icon.Loader className="w-4 h-auto animate-spin mr-1" />
<p className="text-sm italic">{t("memo.fetching-data")}</p>
</div>
) : !nextPageToken ? (
sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)
) : (
{nextPageToken && (
<div className="w-full flex flex-row justify-center items-center my-4">
<Button
variant="plain"
endDecorator={<Icon.ArrowDown className="w-5 h-auto" />}
color="neutral"
loading={isRequesting}
endDecorator={<Icon.ArrowDown className="w-4 h-auto" />}
onClick={() => fetchMemos(nextPageToken)}
>
{t("memo.fetch-more")}
{t("memo.load-more")}
</Button>
</div>
)}
{!nextPageToken && sortedMemos.length === 0 && (
<div className="w-full mt-12 mb-8 flex flex-col justify-center items-center italic">
<Empty />
<p className="mt-2 text-gray-600 dark:text-gray-400">{t("message.no-data")}</p>
</div>
)}
</>
) : (
<p>Not found</p>
Expand Down

0 comments on commit 9a27fdf

Please sign in to comment.