Skip to content

Commit

Permalink
fix: Redirect to load profile on rule editor close (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
going-confetti authored Jul 24, 2024
1 parent 8ca246c commit 6ce828d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/views/Generator/GeneratorDrawer/RuleEditor/RuleEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CorrelationEditor } from './CorrelationEditor'
import { CustomCodeEditor } from './CustomCodeEditor'
import { Box, Callout, IconButton } from '@radix-ui/themes'
import { Cross2Icon, InfoCircledIcon } from '@radix-ui/react-icons'
import { useNavigate } from 'react-router-dom'

export function RuleEditorSwitch() {
const rule = useGeneratorStore(selectSelectedRule)
Expand Down Expand Up @@ -34,19 +35,20 @@ export function RuleEditorSwitch() {
}

export function RuleEditor() {
const navigate = useNavigate()
const selectRule = useGeneratorStore((store) => store.selectRule)
const selectedRuleId = useGeneratorStore((store) => store.selectedRuleId)

const handleClose = () => {
selectRule(null)
navigate('/generator')
}

return (
<Box position="relative">
{selectedRuleId && (
<Box position="absolute" right="0" top="0">
<IconButton
variant="ghost"
title="close"
m="2"
onClick={() => selectRule(null)}
>
<IconButton variant="ghost" title="close" m="2" onClick={handleClose}>
<Cross2Icon />
</IconButton>
</Box>
Expand Down

0 comments on commit 6ce828d

Please sign in to comment.