File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ import { getFormattedConfigTree } from "~/utils/discourseConfigRef";
3333import refreshConfigTree from "~/utils/refreshConfigTree" ;
3434import createBlock from "roamjs-components/writes/createBlock" ;
3535import deleteBlock from "roamjs-components/writes/deleteBlock" ;
36- import { setFeatureFlag } from "~/components/settings/utils/accessors" ;
36+ import {
37+ setFeatureFlag ,
38+ getFeatureFlag ,
39+ } from "~/components/settings/utils/accessors" ;
40+ import { FeatureFlagPanel } from "./components/BlockPropSettingPanels" ;
3741
3842const NodeRow = ( { node } : { node : PConceptFull } ) => {
3943 return (
@@ -346,6 +350,14 @@ const FeatureFlagsTab = (): React.ReactElement => {
346350 </ p >
347351 </ Alert >
348352
353+ < FeatureFlagPanel
354+ title = "Duplicate node alert"
355+ description = "Show possible duplicate nodes when viewing a discourse node page. Requires Suggestive mode to be enabled."
356+ featureKey = "Duplicate node alert enabled"
357+ initialValue = { getFeatureFlag ( "Duplicate node alert enabled" ) }
358+ disabled = { ! suggestiveModeEnabled }
359+ />
360+
349361 < Button
350362 className = "w-96"
351363 icon = "send-message"
Original file line number Diff line number Diff line change @@ -501,6 +501,7 @@ export const FeatureFlagPanel = ({
501501 description,
502502 featureKey,
503503 initialValue,
504+ disabled,
504505 onBeforeEnable,
505506 onAfterChange,
506507 parentUid,
@@ -511,6 +512,7 @@ export const FeatureFlagPanel = ({
511512 description : string ;
512513 featureKey : keyof FeatureFlags ;
513514 initialValue ?: boolean ;
515+ disabled ?: boolean ;
514516 onBeforeEnable ?: ( ) => Promise < boolean > ;
515517 onAfterChange ?: ( checked : boolean ) => void ;
516518} & RoamBlockSyncProps ) => {
@@ -532,6 +534,7 @@ export const FeatureFlagPanel = ({
532534 settingKeys = { [ featureKey as string ] }
533535 setter = { featureFlagSetter }
534536 initialValue = { initialValue }
537+ disabled = { disabled }
535538 onBeforeChange = { handleBeforeChange }
536539 onChange = { onAfterChange }
537540 parentUid = { parentUid }
Original file line number Diff line number Diff line change @@ -89,11 +89,13 @@ const discourseNodeSettings: DiscourseNodeSettings = {
8989const featureFlags : FeatureFlags = {
9090 "Enable left sidebar" : true ,
9191 "Suggestive mode enabled" : true ,
92+ "Duplicate node alert enabled" : true ,
9293} ;
9394
9495const defaultFeatureFlags : FeatureFlags = {
9596 "Enable left sidebar" : false ,
9697 "Suggestive mode enabled" : false ,
98+ "Duplicate node alert enabled" : false ,
9799} ;
98100
99101const exportSettings : ExportSettings = {
Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ export const DiscourseRelationSchema = z.object({
156156export const FeatureFlagsSchema = z . object ( {
157157 "Enable left sidebar" : z . boolean ( ) . default ( false ) ,
158158 "Suggestive mode enabled" : z . boolean ( ) . default ( false ) ,
159+ "Duplicate node alert enabled" : z . boolean ( ) . default ( false ) ,
159160} ) ;
160161
161162export const ExportSettingsSchema = z . object ( {
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ import { formatHexColor } from "~/components/settings/DiscourseNodeCanvasSetting
5454import { getSetting } from "./extensionSettings" ;
5555import { mountLeftSidebar } from "~/components/LeftSidebarView" ;
5656import { getUidAndBooleanSetting } from "./getExportSettings" ;
57+ import { getFeatureFlag } from "~/components/settings/utils/accessors" ;
5758import { getCleanTagText } from "~/components/settings/NodeConfig" ;
5859import getPleasingColors from "@repo/utils/getPleasingColors" ;
5960import { colord } from "colord" ;
@@ -116,7 +117,10 @@ export const initObservers = async ({
116117 const isDiscourseNode = node && node . backedBy !== "default" ;
117118 if ( isDiscourseNode ) {
118119 renderDiscourseContext ( { h1, uid } ) ;
119- if ( isSuggestiveModeEnabled ) {
120+ if (
121+ isSuggestiveModeEnabled &&
122+ getFeatureFlag ( "Duplicate node alert enabled" )
123+ ) {
120124 renderPossibleDuplicates ( h1 , title , node ) ;
121125 }
122126 const linkedReferencesDiv = document . querySelector (
You can’t perform that action at this time.
0 commit comments