
DASHBOARD
maws7140Pomodoro Timer
25-minute focus timer with start, pause and reset, right inside a note.
What you need
- The Datacore community plugin (Settings → Community plugins → Browse, search "Datacore").
- The VaultHub widgets CSS snippet: download vaulthub-widgets.css, save it in your vault's
.obsidian/snippets/folder, then switch it on under Settings → Appearance → CSS snippets. One snippet styles every VaultHub widget.
Add it to a note
Paste the block below into any note. It renders in Live Preview and Reading view.
return function PomodoroTimer() {
const [seconds, setSeconds] = dc.useState(25 * 60);
const [isActive, setIsActive] = dc.useState(false);
dc.useEffect(() => {
let interval = null;
if (isActive && seconds > 0) {
interval = setInterval(() => setSeconds(s => s - 1), 1000);
} else if (seconds === 0) {
setIsActive(false);
clearInterval(interval);
}
return () => clearInterval(interval);
}, [isActive, seconds]);
const mins = String(Math.floor(seconds / 60)).padStart(2, '0');
const secs = String(seconds % 60).padStart(2, '0');
return (
<div className="vh-widget vh-pomodoro">
<div className="vh-pomo-mode">FOCUS SESSION</div>
<div className="vh-pomo-time">{mins}:{secs}</div>
<div className="vh-pomo-controls">
<button className="vh-pomo-btn" onClick={() => setIsActive(!isActive)}>
{isActive ? 'PAUSE' : 'START'}
</button>
<button className="vh-pomo-btn vh-btn-sub" onClick={() => { setIsActive(false); setSeconds(25 * 60); }}>
RESET
</button>
</div>
</div>
);
}
How to Install
- Install the Datacore community plugin
- Add the VaultHub widgets CSS snippet to
.obsidian/snippets/and enable it - Copy the code block on this page into any note
Categories
Tags
vaulthubpomodorofocustimer