-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update macrumors extension #16707
Update macrumors extension #16707
Conversation
- Merge branch \'contributions/merge-1738208931245\' - Pull contributions - Edit Markdown and JSON - Revise export default function and clean up
Thank you for your contribution! 🎉 🔔 @hughmcmillanv you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. You can expect an initial review within five business days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update 🔥
I tweaked the script a bit, I think it will work much better and faster this way 😊
import { Action, ActionPanel, List } from "@raycast/api";
import { useCachedPromise } from "@raycast/utils";
import { getIcon, getPubDate } from "./utils";
import Parser from "rss-parser";
export default function Command() {
const { data, isLoading } = useCachedPromise(async () => {
const parser = new Parser();
const feed = await parser.parseURL("https://feeds.macrumors.com/MacRumors-All");
return { items: feed.items };
});
return (
<List isLoading={isLoading}>
{data?.items?.map((item, index) => <StoryListItem key={item.guid} item={item} index={index} />)}
</List>
);
}
function StoryListItem(props: { item: Parser.Item; index: number }) {
const icon = getIcon(props.index + 1);
const pubDate = new Date(getPubDate(props.item) ?? "");
return (
<List.Item
icon={icon}
title={props.item.title ?? "No title"}
subtitle={props.item.creator ?? "No author"}
accessories={[{ date: pubDate }]}
actions={<Actions item={props.item} />}
/>
);
}
function Actions(props: { item: Parser.Item }) {
return (
<ActionPanel title={props.item.title}>
<ActionPanel.Section>{props.item.link && <Action.OpenInBrowser url={props.item.link} />}</ActionPanel.Section>
<ActionPanel.Section>
{props.item.link && (
<Action.CopyToClipboard
content={props.item.link}
title="Copy Article Link"
shortcut={{ modifiers: ["cmd"], key: "." }}
/>
)}
</ActionPanel.Section>
</ActionPanel>
);
}
Your requested changes to the "macrumors.tsx" file have been incorporated. Thank you very much for your tweaks. 🙂 |
Published to the Raycast Store: |
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |
Description
Screencast
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are placed outside of themetadata
folder