a tool for shared writing and social publishing
at debug/datetime 31 lines 833 B view raw
1"use client"; 2 3import { useSmoker } from "components/Toast"; 4import { fixFeeds } from "./fixFeeds"; 5import { ButtonPrimary } from "components/Buttons"; 6import { DotLoader } from "components/utils/DotLoader"; 7import { useState } from "react"; 8 9export function FixFeedsButton() { 10 let smoker = useSmoker(); 11 let [loading, setLoading] = useState(false); 12 return ( 13 <ButtonPrimary 14 onClick={async (e) => { 15 let rect = e.currentTarget?.getBoundingClientRect(); 16 setLoading(true); 17 await fixFeeds(); 18 setLoading(false); 19 smoker({ 20 position: { 21 x: rect.left + (rect.right - rect.left) / 2, 22 y: rect.top - 16, 23 }, 24 text: "Fixed your feeds!", 25 }); 26 }} 27 > 28 {loading ? <DotLoader /> : "Fix My Feeds"} 29 </ButtonPrimary> 30 ); 31}