shadcn.io is not affiliated with official shadcn/ui
Keyword Alerts Comments Block for Svelte
Alert rules that watch comments for a word or phrase and name who to alert and on which channel, with Switches, an Add rule form and a tester that marks the matches in a comment you type.
Installation
Overview
Page the person who should know the moment a comment says something that matters, with these alert rules for Svelte with Ark UI. It is the rule page of Tripwick, a tool that escalates from comment keywords: a compact header, then one hairline frame in three bands. The first lists the rules in a held list that scrolls once there are more than four: each shows the word or phrase, who it alerts, the channel as a Badge and a Switch, under the count "3 of 4 rules on". The second adds a rule with an Input, a Native Select for who to alert and the only Shine Button, Add rule, which refuses an empty or repeated phrase. The third is a tester: type or paste a comment into a Textarea and the rules run as you type, whole words in any case, marking each match in the text and saying "Would alert: refund, Support lead". A rule that is switched off never alerts, and the tester says so when its word shows up. It is built from Switch, Input, Textarea, Native Select, Shine Button, Badge, Field and Guides, with a CSS entrance only. For support desks, community teams and any inbox where some words need a faster answer.
FAQ
How do I use my own rules and people?
Edit AUDIENCES (an id, a label and the channel that person hears it on) and START (each rule has an id, the phrase, the audience and whether it is on). LIMIT is the most rules the demo keeps and SAMPLE is the comment the tester starts with. The channel comes from the audience, so changing a person's channel changes every rule that alerts them.
How does the matching work?
Each phrase is turned into a regular expression with its special characters escaped, bounded by word edges and matched in any case, so "refund" matches "Refund" and "refunds" does not match "refund". Matches from different rules that overlap are merged into one mark. This is plain pattern matching in the page, not a model; accents, other alphabets and stemming need a better matcher on your server.
What does the tester do with a switched-off rule?
Nothing alerts. If its phrase appears in the text, the line under the result names it ("1 rule is off, so “cancel my plan” stays quiet"), so you can see why a comment did not alert. Switching the rule on makes the next keystroke, or the switch itself, mark it and add it to the "Would alert" line.
What stays local, and how do I make it real?
The rules and the tester. Add rule puts the rule in the list and nothing is saved or sent. To wire it up, save rules from add and flip, run the same matching on the server when a comment is posted (never trust the browser to alert), and deliver the alert on its channel with the comment's link. Keep the tester: it is how people trust a rule before they turn it on.
Is it accessible?
Every Switch is named for its phrase, the problem for an empty or repeated rule is written under the field and described to it, and a match is marked with a heavy underline and a tint as well as being listed in words. The rules list is a labelled scroll region you can reach with Tab. Each change is read from one polite status line.