Skip to content

Commit

Permalink
Update imdb extension (raycast#13413)
Browse files Browse the repository at this point in the history
* Update imdb extension

- fix: lint
- docs: update changelog
- feat: add action Open Parental Guide
- Initial commit

* fix: remove pnpm lock file

* feat: add icon

* fix: icon
  • Loading branch information
owain-williams committed Jul 11, 2024
1 parent cdc6022 commit 928fa48
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions extensions/imdb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# IMDb Changelog

## [Update] - 2024-07-10

- Add an action to open the parental guide

## [Update] - 2024-03-21

- Add a new preference to allow users to choose whether to open a result in Raycast or in the browser by default.
Expand Down
3 changes: 2 additions & 1 deletion extensions/imdb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"contributors": [
"kgrhartlage",
"bibixx",
"dnsv"
"dnsv",
"AndersDigital"
],
"keywords": [
"imdb",
Expand Down
11 changes: 6 additions & 5 deletions extensions/imdb/src/components/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { ActionPanel, Action, List, Icon } from '@raycast/api';
import ItemDetail from './ItemDetail';
import { Color } from '@raycast/api';
import { Action, ActionPanel, Color, Icon, List } from '@raycast/api';
import { useFetch } from '@raycast/utils';
import { mapTypeToTitle, processSeasons } from '../utils';
import {
DetailedItem,
getDetailsEndpoint,
parseDetailsResponse,
} from '../data/fetchDetails';
import { BaseItem } from '../data/fetchList';
import { usePreferences } from '../hooks/usePreferences';
import ActionViewDetails from './actions/ActionViewDetails';
import { mapTypeToTitle, processSeasons } from '../utils';
import ActionOpenInBrowserIMDb from './actions/ActionOpenInBrowserIMDb';
import ActionOpenParentalGuide from './actions/ActionOpenParentalGuide';
import ActionViewDetails from './actions/ActionViewDetails';

interface ListItemProps {
item: BaseItem;
Expand Down Expand Up @@ -41,10 +40,12 @@ export const ListItem = ({ item: { imdbID }, showType }: ListItemProps) => {
<>
<ActionViewDetails item={data} />
<ActionOpenInBrowserIMDb imdbID={imdbID} />
<ActionOpenParentalGuide imdbID={imdbID} />
</>
) : (
<>
<ActionOpenInBrowserIMDb imdbID={imdbID} />
<ActionOpenParentalGuide imdbID={imdbID} />
<ActionViewDetails item={data} />
</>
)}
Expand Down
17 changes: 17 additions & 0 deletions extensions/imdb/src/components/actions/ActionOpenParentalGuide.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Action } from '@raycast/api';
import { Icon } from '@raycast/api';

type Props = {
imdbID: string;
};

const ActionOpenParentalGuide = ({ imdbID }: Props) => (
<Action.OpenInBrowser
url={`https://www.imdb.com/title/${imdbID}/parentalguide`}
title="Open Parental Guide"
shortcut={{ modifiers: ['shift', 'cmd'], key: 'p' }}
icon={Icon.SpeechBubbleImportant}
/>
);

export default ActionOpenParentalGuide;

0 comments on commit 928fa48

Please sign in to comment.