-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ caching and skeletons * 🐛 fix the swr revalidation errors * 💄 fix dark mode typing indicator
- Loading branch information
Showing
10 changed files
with
312 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Conversation } from "@/utils/api"; | ||
import { FaEdit, FaTrash } from "react-icons/fa"; | ||
import Skeleton from "react-loading-skeleton"; | ||
|
||
interface ConversationTabRegularProps { | ||
conversation: Conversation; | ||
select: () => void; | ||
selected: boolean; | ||
edit: () => void; | ||
del: () => void; | ||
loading?: false; | ||
} | ||
|
||
interface ConversationTabLoadingProps { | ||
conversation?: undefined; | ||
select?: undefined; | ||
selected?: undefined; | ||
edit?: undefined; | ||
del?: undefined; | ||
loading: true; | ||
} | ||
|
||
type ConversationTabProps = | ||
| ConversationTabRegularProps | ||
| ConversationTabLoadingProps; | ||
|
||
export function ConversationTab({ | ||
conversation, | ||
select, | ||
selected, | ||
edit, | ||
del, | ||
loading, | ||
}: ConversationTabProps) { | ||
return ( | ||
<div | ||
className={`flex justify-between items-center p-4 cursor-pointer hover:bg-gray-200 hover:dark:bg-gray-800 ${ | ||
selected ? "bg-gray-200 dark:bg-gray-800" : "" | ||
}`} | ||
onClick={select} | ||
> | ||
{loading ? ( | ||
<div className="flex-1"> | ||
<Skeleton /> | ||
</div> | ||
) : ( | ||
<> | ||
<div> | ||
<h2 className="font-bold overflow-ellipsis overflow-hidden "> | ||
{conversation.name || "Untitled"} | ||
</h2> | ||
</div> | ||
<div className="flex flex-row justify-end gap-2 items-center w-1/5"> | ||
<button className="text-gray-500" onClick={edit}> | ||
<FaEdit /> | ||
</button> | ||
<button className="text-red-500" onClick={del}> | ||
<FaTrash /> | ||
</button> | ||
</div> | ||
</> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React from 'react'; | ||
import React from "react"; | ||
|
||
const Loading = () => { | ||
return ( | ||
|
Oops, something went wrong.