-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Timers): alert sound failure, close window on start pref (#13457)
* fix(Timers): alert sound failure, close window on start pref * Update CHANGELOG.md * Update CHANGELOG.md and optimise images --------- Co-authored-by: Milena Araujo <mil3na@users.noreply.github.com> Co-authored-by: raycastbot <bot@raycast.com>
- Loading branch information
1 parent
cdd567d
commit 0f37f67
Showing
12 changed files
with
199 additions
and
155 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,53 @@ | ||
import { Action, ActionPanel, Icon, List } from "@raycast/api"; | ||
import { CommandLinkParams, CustomTimer } from "../backend/types"; | ||
import { formatTime } from "../backend/formatUtils"; | ||
import useTimers from "../hooks/useTimers"; | ||
import RenameAction from "./RenameAction"; | ||
|
||
const createPresetLink = (ctID: string): string => { | ||
const payload: CommandLinkParams = { timerID: ctID }; | ||
const encodedPayload = encodeURIComponent(JSON.stringify(payload)); | ||
return `raycast://extensions/ThatNerd/timers/manageTimers?context=${encodedPayload}`; | ||
}; | ||
|
||
export default function CustomTimerListItem(props: { customTimer: CustomTimer; id: string }) { | ||
const { handleStartCT, handleDeleteCT } = useTimers(); | ||
return ( | ||
<List.Item | ||
icon={Icon.Clock} | ||
title={props.customTimer.name} | ||
subtitle={formatTime(props.customTimer.timeInSeconds)} | ||
actions={ | ||
<ActionPanel> | ||
<Action | ||
title="Start Timer" | ||
icon={Icon.Hourglass} | ||
onAction={() => handleStartCT({ customTimer: props.customTimer })} | ||
/> | ||
<RenameAction | ||
renameLabel="Timer" | ||
currentName={props.customTimer.name} | ||
originalFile={"customTimer"} | ||
ctID={props.id} | ||
/> | ||
<Action | ||
title="Delete Custom Timer" | ||
icon={Icon.Trash} | ||
shortcut={{ | ||
modifiers: ["ctrl"], | ||
key: "x", | ||
}} | ||
onAction={() => handleDeleteCT(props.id)} | ||
/> | ||
<Action.CreateQuicklink | ||
quicklink={{ | ||
name: props.customTimer.name, | ||
link: createPresetLink(props.id), | ||
}} | ||
title="Add Preset to Root Search" | ||
/> | ||
</ActionPanel> | ||
} | ||
/> | ||
); | ||
} |
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,20 @@ | ||
import { Action, Icon, useNavigation } from "@raycast/api"; | ||
import { RenameView, RenameViewProps } from "./RenameView"; | ||
|
||
interface RenameActionProps extends RenameViewProps { | ||
renameLabel: string; | ||
} | ||
|
||
export default function RenameAction(props: RenameActionProps) { | ||
const { push } = useNavigation(); | ||
|
||
return ( | ||
<Action | ||
title={`Rename ${props.renameLabel}`} | ||
icon={Icon.TextInput} | ||
onAction={() => | ||
push(<RenameView currentName={props.currentName} originalFile={props.originalFile} ctID={props.ctID} />) | ||
} | ||
/> | ||
); | ||
} |
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,43 @@ | ||
import { Action, ActionPanel, Color, Icon, List } from "@raycast/api"; | ||
import { Timer } from "../backend/types"; | ||
import { formatDateTime, formatTime } from "../backend/formatUtils"; | ||
import useTimers from "../hooks/useTimers"; | ||
import RenameAction from "./RenameAction"; | ||
|
||
interface RunningTimerListItemProps { | ||
timer: Timer; | ||
} | ||
|
||
const runningLabel = { tag: { value: "Running", color: Color.Yellow } }; | ||
const finishedLabel = { tag: { value: "Finished!", color: Color.Green } }; | ||
|
||
export default function RunningTimerListItem({ timer }: RunningTimerListItemProps) { | ||
const { handleStopTimer, handleCreateCT } = useTimers(); | ||
return ( | ||
<List.Item | ||
icon={{ source: Icon.Clock, tintColor: timer.timeLeft === 0 ? Color.Green : Color.Yellow }} | ||
title={timer.name} | ||
subtitle={formatTime(timer.timeLeft) + " left"} | ||
accessories={[ | ||
{ text: formatTime(timer.secondsSet) + " originally" }, | ||
{ text: `${timer.timeLeft === 0 ? "Ended" : "Ends"} at ${formatDateTime(timer.timeEnds)}` }, | ||
timer.timeLeft === 0 ? finishedLabel : runningLabel, | ||
]} | ||
actions={ | ||
<ActionPanel> | ||
<Action title="Stop Timer" icon={Icon.Stop} onAction={() => handleStopTimer(timer)} /> | ||
<RenameAction renameLabel={"Timer"} currentName={timer.name} originalFile={timer.originalFile} ctID={null} /> | ||
<Action | ||
title="Save Timer as Preset" | ||
icon={Icon.SaveDocument} | ||
shortcut={{ | ||
modifiers: ["cmd", "shift"], | ||
key: "enter", | ||
}} | ||
onAction={() => handleCreateCT(timer)} | ||
/> | ||
</ActionPanel> | ||
} | ||
/> | ||
); | ||
} |
Oops, something went wrong.