mirror of
https://github.com/Sevichecc/raycast-akkoma-extension.git
synced 2025-04-30 14:49:29 +08:00
feat: filter the reblog statuses from my status
This commit is contained in:
parent
fff1f02d8a
commit
b007eea53d
2 changed files with 16 additions and 9 deletions
|
@ -10,7 +10,7 @@ const cache = new Cache();
|
|||
|
||||
export default function ViewStatusCommand() {
|
||||
const cached = cache.get("latest_statuses");
|
||||
const [status, setStatus] = useState<Status[]>(cached ? JSON.parse(cached) : []);
|
||||
const [statuses, setStatuses] = useState<Status[]>(cached ? JSON.parse(cached) : []);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -19,7 +19,7 @@ export default function ViewStatusCommand() {
|
|||
await getAccessToken();
|
||||
showToast(Toast.Style.Animated, "Loading Status...ε=ε=┌( >_<)┘");
|
||||
const status = await apiServer.fetchUserStatus();
|
||||
setStatus(status);
|
||||
setStatuses(statuses);
|
||||
showToast(Toast.Style.Success, "Statuses has been loaded ٩(•̤̀ᵕ•̤́๑)ᵒᵏᵎᵎᵎᵎ");
|
||||
cache.set("latest_statuses", JSON.stringify(status));
|
||||
} catch (error) {
|
||||
|
@ -32,9 +32,11 @@ export default function ViewStatusCommand() {
|
|||
getBookmark();
|
||||
}, []);
|
||||
|
||||
const filterReblog = (statuses:Status[]) => statuses.filter((status)=>!status.reblog)
|
||||
|
||||
return (
|
||||
<List isShowingDetail isLoading={isLoading} searchBarPlaceholder="Search your status">
|
||||
{status?.map((status) => (
|
||||
{filterReblog(statuses)?.map((status) => (
|
||||
<List.Item
|
||||
title={status.akkoma.source.content}
|
||||
key={status.id}
|
||||
|
|
|
@ -64,12 +64,7 @@ export interface StatusRequest {
|
|||
export interface Status {
|
||||
created_at: Date;
|
||||
media_attachments: UploadAttachResponse[];
|
||||
akkoma: {
|
||||
source: {
|
||||
content: string;
|
||||
mediaType: "text/markdown" | "text/plain" | "text/bbcode" | "text/html" | "x.misskeymarkdown";
|
||||
};
|
||||
};
|
||||
akkoma: AkkomaSource
|
||||
account: {
|
||||
acct: string;
|
||||
};
|
||||
|
@ -83,8 +78,18 @@ export interface Status {
|
|||
};
|
||||
id: string;
|
||||
fqn: string;
|
||||
reblog: {
|
||||
content: string
|
||||
akkoma: AkkomaSource
|
||||
}
|
||||
}
|
||||
|
||||
interface AkkomaSource {
|
||||
source: {
|
||||
content: string;
|
||||
mediaType: "text/markdown" | "text/plain" | "text/bbcode" | "text/html" | "x.misskeymarkdown";
|
||||
};
|
||||
}
|
||||
// API Responses
|
||||
export interface ApiResponse {
|
||||
id: number;
|
||||
|
|
Loading…
Reference in a new issue