Skip to content

Commit

Permalink
fix: unclickable menu items (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelwt authored Jun 25, 2024
1 parent 27be2f8 commit 3194b87
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
4 changes: 1 addition & 3 deletions packages/frontend/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import { useEffect, useState } from "react"
import { ResourceName, hasAccess, hasReadAccess, serializeLogic } from "shared"
import config from "@/utils/config"
import { useViews } from "@/utils/dataHooks/views"
import { useLocalStorage } from "@mantine/hooks"

function NavbarLink({
icon: Icon,
Expand Down Expand Up @@ -126,8 +125,7 @@ export default function Sidebar() {
const { projects, isLoading: loading, insert } = useProjects()
const { views } = useViews()

const { colorScheme, setColorScheme, clearColorScheme } =
useMantineColorScheme({})
const { colorScheme, setColorScheme } = useMantineColorScheme({})

const [createProjectLoading, setCreateProjectLoading] = useState(false)

Expand Down
12 changes: 5 additions & 7 deletions packages/frontend/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import UpgradeModal from "./UpgradeModal"

export default function Layout({ children }: { children: ReactNode }) {
const router = useRouter()
const { user } = useUser()
const { org } = useOrg()

const colorScheme = useComputedColorScheme()
const { isSignedIn } = useAuth()

const isAuthPage = !![
"/login",
Expand All @@ -35,8 +40,6 @@ export default function Layout({ children }: { children: ReactNode }) {

const isPublicPage = isLLMCallPage

const { isSignedIn } = useAuth()

useEffect(() => {
if (isMaintenanceMode) {
router.push("/maintenance")
Expand All @@ -53,14 +56,9 @@ export default function Layout({ children }: { children: ReactNode }) {
return
}
}, [isSignedIn])
const { user } = useUser()
const { org } = useOrg()
const { project } = useProject()

const isPromptPage = router.pathname.startsWith("/prompt")

const colorScheme = useComputedColorScheme()

useEffect(() => {
if (user) {
analytics.identify(user.id, {
Expand Down
29 changes: 15 additions & 14 deletions packages/frontend/pages/logs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
Group,
Loader,
Menu,
SegmentedControl,
Stack,
Text,
} from "@mantine/core"
Expand All @@ -32,17 +31,13 @@ import {
IconBrandOpenai,
IconDotsVertical,
IconFileExport,
IconListTree,
IconMessages,
IconFilter,
IconSquaresDiagonal,
IconLayersIntersect,
IconTrash,
IconCopy,
} from "@tabler/icons-react"

import { NextSeo } from "next-seo"
import { use, useContext, useEffect, useState } from "react"
import { useContext, useEffect, useMemo, useState } from "react"

import { ChatReplay } from "@/components/blocks/RunChat"
import RunInputOutput from "@/components/blocks/RunInputOutput"
Expand Down Expand Up @@ -232,24 +227,30 @@ export default function Logs() {
}
}, [selectedRun?.projectId])

useDidUpdate(() => {
let serialized = serializeLogic(filters)

if (typeof serialized === "string") {
setSerializedChecks(serialized)
const fullUrlPath = useMemo(() => {
let serializedString = serializeLogic(filters)

if (typeof serializedString === "string") {
if (viewId) {
serialized += `&view=${viewId}`
serializedString += `&view=${viewId}`
}

if (selectedRunId) {
serialized += `&selected=${selectedRunId}`
serializedString += `&selected=${selectedRunId}`
}

router.replace(`/logs?${serialized}`)
console.log(`serialized: ${serializedString}`)
}

return serializedString
}, [filters, viewId, selectedRunId])

useDidUpdate(() => {
if (typeof fullUrlPath === "string") {
router.replace(`/logs?${fullUrlPath}`)
}
}, [fullUrlPath])

// Ensure the 'type' filter is always the first filter and re-add it if it was removed
useEffect(() => {
const typeFilter = filters.find((filter) => filter.id === "type")
Expand Down

0 comments on commit 3194b87

Please sign in to comment.