-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add new customization components - Added CustomOrgSelector component - Added CustomProfileIcon component - Added CustomProductSelector component - Added CustomHeaderMenuItemsTitle component - Added CustomFeedbackDialog component This commit adds new customization components to the codebase. * [autofix.ci] apply automated fixes * refactor: update AppHeader component styling * refactor: update AppHeader component styling * refactor: update HeaderMenu component styling --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d8ebfad
commit d48ec86
Showing
39 changed files
with
827 additions
and
399 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/frontend/src/components/appHeaderComponent/assets/ChainIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/frontend/src/components/appHeaderComponent/assets/ExpandMoreIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/frontend/src/components/appHeaderComponent/assets/FeedbackIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
src/frontend/src/components/appHeaderComponent/assets/OrgSelectorIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/frontend/src/components/appHeaderComponent/assets/ScienceOutlinedIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
src/frontend/src/components/appHeaderComponent/assets/ShortDataStaxLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
src/frontend/src/components/appHeaderComponent/assets/ShortLangFlowIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions
134
src/frontend/src/components/appHeaderComponent/components/AccountMenu/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import { useLogout } from "@/controllers/API/queries/auth"; | ||
import { CustomFeedbackDialog } from "@/customization/components/custom-feedback-dialog"; | ||
import { CustomHeaderMenuItemsTitle } from "@/customization/components/custom-header-menu-items-title"; | ||
import { CustomProfileIcon } from "@/customization/components/custom-profile-icon"; | ||
import { ENABLE_DATASTAX_LANGFLOW } from "@/customization/feature-flags"; | ||
import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate"; | ||
import useAuthStore from "@/stores/authStore"; | ||
import { useDarkStore } from "@/stores/darkStore"; | ||
import { useState } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import GithubStarComponent from "../GithubStarButton"; | ||
import { | ||
HeaderMenu, | ||
HeaderMenuItemButton, | ||
HeaderMenuItemLink, | ||
HeaderMenuItems, | ||
HeaderMenuItemsSection, | ||
HeaderMenuToggle, | ||
} from "../HeaderMenu"; | ||
import { ProfileIcon } from "../ProfileIcon"; | ||
import ThemeButtons from "../ThemeButtons"; | ||
|
||
export const AccountMenu = () => { | ||
const [isFeedbackOpen, setIsFeedbackOpen] = useState(false); | ||
const { customParam: id } = useParams(); | ||
const version = useDarkStore((state) => state.version); | ||
const navigate = useCustomNavigate(); | ||
const { mutate: mutationLogout } = useLogout(); | ||
|
||
const { isAdmin, autoLogin } = useAuthStore((state) => ({ | ||
isAdmin: state.isAdmin, | ||
autoLogin: state.autoLogin, | ||
})); | ||
|
||
const handleLogout = () => { | ||
mutationLogout(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<HeaderMenu> | ||
<HeaderMenuToggle> | ||
<div | ||
className="h-7 w-7 rounded-full focus-visible:outline-0" | ||
data-testid="user-profile-settings" | ||
> | ||
{ENABLE_DATASTAX_LANGFLOW ? <CustomProfileIcon /> : <ProfileIcon />} | ||
</div> | ||
</HeaderMenuToggle> | ||
<HeaderMenuItems position="right"> | ||
{ENABLE_DATASTAX_LANGFLOW && <CustomHeaderMenuItemsTitle />} | ||
<HeaderMenuItemsSection> | ||
<div className="flex h-[46px] w-full items-center justify-between pl-2"> | ||
<div className="text-sm text-zinc-500">Version {version}</div> | ||
<ThemeButtons /> | ||
</div> | ||
{ENABLE_DATASTAX_LANGFLOW ? ( | ||
<HeaderMenuItemLink newPage href={`/settings/org/${id}/overview`}> | ||
Account Settings | ||
</HeaderMenuItemLink> | ||
) : ( | ||
<HeaderMenuItemButton | ||
onClick={() => { | ||
navigate("/settings"); | ||
}} | ||
> | ||
Settings | ||
</HeaderMenuItemButton> | ||
)} | ||
{!ENABLE_DATASTAX_LANGFLOW && ( | ||
<> | ||
{isAdmin && !autoLogin && ( | ||
<HeaderMenuItemButton onClick={() => navigate("/admin")}> | ||
Admin Page | ||
</HeaderMenuItemButton> | ||
)} | ||
</> | ||
)} | ||
{ENABLE_DATASTAX_LANGFLOW ? ( | ||
<HeaderMenuItemButton onClick={() => setIsFeedbackOpen(true)}> | ||
Feedback | ||
</HeaderMenuItemButton> | ||
) : ( | ||
<HeaderMenuItemLink newPage href="https://docs.langflow.org"> | ||
Docs | ||
</HeaderMenuItemLink> | ||
)} | ||
</HeaderMenuItemsSection> | ||
<HeaderMenuItemsSection> | ||
{ENABLE_DATASTAX_LANGFLOW ? ( | ||
<HeaderMenuItemLink | ||
newPage | ||
href="https://github.com/langflow-ai/langflow" | ||
> | ||
<div className="-my-2 mr-2 flex w-full items-center justify-between"> | ||
<div className="text-sm">Star the repo</div> | ||
<GithubStarComponent /> | ||
</div> | ||
</HeaderMenuItemLink> | ||
) : ( | ||
<HeaderMenuItemLink | ||
newPage | ||
href="https://github.com/langflow-ai/langflow/discussions" | ||
> | ||
Share Feedback on Github | ||
</HeaderMenuItemLink> | ||
)} | ||
<HeaderMenuItemLink newPage href="https://twitter.com/langflow_ai"> | ||
Follow {ENABLE_DATASTAX_LANGFLOW ? "Langflow" : "us"} on X | ||
</HeaderMenuItemLink> | ||
<HeaderMenuItemLink newPage href="https://discord.gg/EqksyE2EX9"> | ||
Join our Discord | ||
</HeaderMenuItemLink> | ||
</HeaderMenuItemsSection> | ||
<HeaderMenuItemsSection> | ||
{ENABLE_DATASTAX_LANGFLOW ? ( | ||
<HeaderMenuItemLink href="/session/logout"> | ||
Logout | ||
</HeaderMenuItemLink> | ||
) : ( | ||
<HeaderMenuItemButton onClick={handleLogout}> | ||
Logout | ||
</HeaderMenuItemButton> | ||
)} | ||
</HeaderMenuItemsSection> | ||
</HeaderMenuItems> | ||
</HeaderMenu> | ||
<CustomFeedbackDialog | ||
isOpen={isFeedbackOpen} | ||
setIsOpen={setIsFeedbackOpen} | ||
/> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/frontend/src/components/appHeaderComponent/components/GithubStarButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useDarkStore } from "@/stores/darkStore"; | ||
import { FaGithub } from "react-icons/fa"; | ||
|
||
export const GithubStarComponent = () => { | ||
const stars = useDarkStore((state) => state.stars); | ||
|
||
return ( | ||
<div className="header-github-link gap-1 bg-zinc-100 dark:bg-zinc-900 dark:hover:bg-zinc-900"> | ||
<FaGithub className="h-4 w-4 text-black dark:text-[white]" /> | ||
<div className="hidden text-black dark:text-[white] lg:block">Star</div> | ||
<div className="header-github-display text-black dark:text-[white]"> | ||
{stars.toLocaleString() ?? 0} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GithubStarComponent; |
Oops, something went wrong.