Skip to content

Commit a8525cd

Browse files
committed
have add problem button only appear in module.problems.json tab
1 parent 4325262 commit a8525cd

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/components/Editor/EditorTabBar.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
branchAtom,
77
githubInfoAtom,
88
octokitAtom,
9+
tabAtom,
910
trueFileAtom,
1011
trueFilePathAtom,
1112
} from '../../atoms/editor';
@@ -121,15 +122,17 @@ const EditorTabBar: React.FC<EditorTabBarProps> = ({
121122
>
122123
Format Code
123124
</button>
124-
<button
125-
className={classNames(
126-
'text-gray-400 hover:text-gray-300 hover:bg-gray-800 active:bg-gray-800',
127-
'px-3 py-2 font-medium text-sm focus:outline-none transition'
128-
)}
129-
onClick={() => setDialogOpen(true)}
130-
>
131-
Add Problem
132-
</button>
125+
{useAtomValue(tabAtom) === 'problems' && (
126+
<button
127+
className={classNames(
128+
'text-gray-400 hover:text-gray-300 hover:bg-gray-800 active:bg-gray-800',
129+
'px-3 py-2 font-medium text-sm focus:outline-none transition'
130+
)}
131+
onClick={() => setDialogOpen(true)}
132+
>
133+
Add Problem
134+
</button>
135+
)}
133136
{githubInfo && octokit && file && branch && (
134137
<button
135138
className={classNames(

0 commit comments

Comments
 (0)