From 38d6ae87b64999ae146ed4e1ae464a8e12feada9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 12 Aug 2025 16:35:27 +0300 Subject: [PATCH] feat(call-to-action): add support for multiple actions --- .../src/widgets/dialogs/call_to_action.tsx | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/apps/client/src/widgets/dialogs/call_to_action.tsx b/apps/client/src/widgets/dialogs/call_to_action.tsx index 073362e98..ea0d087ae 100644 --- a/apps/client/src/widgets/dialogs/call_to_action.tsx +++ b/apps/client/src/widgets/dialogs/call_to_action.tsx @@ -1,3 +1,4 @@ +import { useMemo, useState } from "preact/hooks"; import Button from "../react/Button"; import Modal from "../react/Modal"; import ReactBasicWidget from "../react/ReactBasicWidget"; @@ -10,26 +11,52 @@ interface CallToAction { }[]; } -function CallToActionDialogComponent() { - const CallToAction: CallToAction = { +const CALL_TO_ACTIONS: CallToAction[] = [ + { title: "Background effects are now stable", message: "On Windows devices, background effects are now fully stable. The background effects adds a touch of color to the user interface by blurring the background behind it. This technique is also used in other applications such as Windows Explorer.", buttons: [ { text: "Enable background effects" } ] - }; + }, + { + title: "TriliumNext theme is now stable", + message: "For a while now, we've been working on a new theme to give the application a more modern look.", + buttons: [ + { text: "Switch to the TriliumNext theme"} + ] + } +]; + +function CallToActionDialogComponent() { + const [ activeIndex, setActiveIndex ] = useState(0); + const [ shown, setShown ] = useState(true); + const activeItem = CALL_TO_ACTIONS[activeIndex]; + + function goToNext() { + if (activeIndex + 1 < CALL_TO_ACTIONS.length) { + setActiveIndex(activeIndex + 1); + } else { + setShown(false); + } + } return ( +