caption: Cooking Mode
created: 20260428113215319
description: Enter or exit focused cooking mode
list-before: $:/core/ui/Buttons/close
modified: 20260428122500394
tags: $:/tags/ViewToolbar
title: $:/community/recipes/ui/Buttons/cooking-mode
type: text/vnd.tiddlywiki

\whitespace trim
<% if [<currentTiddler>tag[Recipe]] [[$:/state/community/recipes/cooking-mode]get[text]!is[blank]] %>
<$let cookState={{{ [[$:/state/community/recipes/cooking-mode]get[text]] }}}>
<%if [<cookState>!is[blank]] %>
<$button class={{{ [<tv-config-toolbar-class>addsuffix[ tc-recipe-cooking-mode-btn]] }}} tooltip=<<t Buttons/CookingMode/ExitTooltip>> aria-label=<<t Buttons/CookingMode/ExitAriaLabel>>>
<$action-setfield $tiddler="$:/state/sidebar"
  text={{{ [[$:/state/community/recipes/cooking-save/sidebar]get[text]else[yes]] }}}/>
<%if [<currentTiddler>match<cookState>] %>
<$action-setfield $tiddler="$:/StoryList"
  list={{{ [[$:/state/community/recipes/cooking-save/story]get[text]] }}}/>
<% else %>
<$action-sendmessage $message="tm-close-tiddler" $param=<<currentTiddler>>/>
<% endif %>
<$action-sendmessage $message="tm-navigate" $param=<<cookState>>/>
<$action-setfield $tiddler="$:/state/community/recipes/cooking-mode" text=""/>
{{$:/community/recipes/images/cooking-mode-off-icon}}
</$button>
<% else %>
<$button class={{{ [<tv-config-toolbar-class>addsuffix[ tc-recipe-cooking-mode-btn]] }}} tooltip=<<t Buttons/CookingMode/EnterTooltip>> aria-label=<<t Buttons/CookingMode/EnterAriaLabel>>>
<$action-setfield $tiddler="$:/state/community/recipes/cooking-save/sidebar"
  text={{{ [[$:/state/sidebar]get[text]else[yes]] }}}/>
<$action-setfield $tiddler="$:/state/community/recipes/cooking-save/story"
  text={{{ [[$:/StoryList]get[list]] }}}/>
<$action-setfield $tiddler="$:/state/community/recipes/cooking-mode" text=<<currentTiddler>>/>
<$action-setfield $tiddler="$:/state/sidebar" text="no"/>
<$action-setfield $tiddler="$:/StoryList" list={{{ [<currentTiddler>format:titlelist[]] }}}/>
{{$:/community/recipes/images/cooking-mode-icon}}
</$button>
<% endif %>
</$let>
<% endif %>
