Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Mar 22, 2024
1 parent cf41bfa commit e6d7d89
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 94 deletions.
7 changes: 6 additions & 1 deletion frontend/src/toolbar/bar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ function MoreMenu(): JSX.Element {
)
}

export function ToolbarInfoMenu(): JSX.Element {
export function ToolbarInfoMenu(): JSX.Element | null {
const ref = useRef<HTMLDivElement | null>(null)
const { visibleMenu, isDragging, menuProperties, minimized, isBlurred } = useValues(toolbarLogic)
const { setMenu } = useActions(toolbarLogic)
const { isAuthenticated } = useValues(toolbarConfigLogic)

const content = minimized ? null : visibleMenu === 'flags' ? (
<FlagsToolbarMenu />
Expand All @@ -104,6 +105,10 @@ export function ToolbarInfoMenu(): JSX.Element {
return () => setMenu(null)
}, [ref.current])

if (!isAuthenticated) {
return null
}

return (
<div
className={clsx(
Expand Down
1 change: 1 addition & 0 deletions frontend/src/toolbar/bar/ToolbarButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
border: none;
border-radius: var(--radius);
transition: transform 100ms ease;
font-weight: 600;

> svg {
font-size: 1.5rem;
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/toolbar/flags/flagsToolbarLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ export const flagsToolbarLogic = kea<flagsToolbarLogicType>([
`/api/projects/@current/feature_flags/my_flags${encodeParams(params, '?')}`
)

if (response.status >= 400) {
toolbarConfigLogic.actions.tokenExpired()
return []
}

breakpoint()
if (!response.ok) {
return []
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/toolbar/toolbarConfigLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ export async function toolbarFetch(
if (response.status === 403) {
const responseData = await response.json()
// Do not try to authenticate if the user has no project access altogether
if (responseData.detail !== "You don't have access to the project.") {
if (responseData.detail === "You don't have access to the project.") {
toolbarConfigLogic.actions.authenticate()
}
}
if (response.status == 401) {
toolbarConfigLogic.actions.tokenExpired()
}
return response
}
87 changes: 0 additions & 87 deletions frontend/src/toolbar/toolbarLogic.ts

This file was deleted.

0 comments on commit e6d7d89

Please sign in to comment.