-
Notifications
You must be signed in to change notification settings - Fork 60.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add fanyi add top tip #5470
Merged
+556
−66
Merged
add fanyi add top tip #5470
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
62efab9
add fanyi add top tip
mayfwl 9858d1f
add top tip
mayfwl 702f5bd
fex setCookie
mayfwl 51f7b02
fex en
mayfwl 518e0d9
fex url
mayfwl c15c852
fex media
mayfwl 6d5bf49
fix media
mayfwl fe4cba8
fix style slect button
mayfwl 248d276
fix style
mayfwl 77f037a
add maidian
mayfwl a6b920d
fix
mayfwl 10d472e
fix
mayfwl e83f61e
fix
mayfwl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,12 +5,13 @@ import { useNavigate } from "react-router-dom"; | |
import { Path, SAAS_CHAT_URL } from "../constant"; | ||
import { useAccessStore } from "../store"; | ||
import Locale from "../locales"; | ||
import Delete from "../icons/www-delete.svg"; | ||
import Delete from "../icons/close.svg"; | ||
import Arrow from "../icons/arrow.svg"; | ||
import Logo from "../icons/logo.svg"; | ||
import BotIcon from "../icons/bot.svg"; | ||
import { getClientConfig } from "../config/client"; | ||
import LeftIcon from "@/app/icons/left.svg"; | ||
import { safeLocalStorage } from "@/app/utils"; | ||
|
||
export function AuthPage() { | ||
const navigate = useNavigate(); | ||
|
@@ -112,20 +113,21 @@ export function AuthPage() { | |
function TopBanner() { | ||
const [isHovered, setIsHovered] = useState(false); | ||
const [isVisible, setIsVisible] = useState(true); | ||
const storage = safeLocalStorage(); | ||
|
||
useEffect(() => { | ||
// 检查 localStorage 中是否有标记 | ||
const bannerDismissed = localStorage.getItem("bannerDismissed"); | ||
const bannerDismissed = storage.getItem("bannerDismissed"); | ||
|
||
// 如果标记不存在,存储默认值并显示横幅 | ||
if (!bannerDismissed) { | ||
localStorage.setItem("bannerDismissed", "false"); | ||
storage.setItem("bannerDismissed", "false"); | ||
setIsVisible(true); // 显示横幅 | ||
} else if (bannerDismissed === "true") { | ||
// 如果标记为 "true",则隐藏横幅 | ||
setIsVisible(false); | ||
} | ||
}, []); | ||
}, [storage]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要作为组件内部的依赖项初始化storage,只需要初始化一次 不需要每次render都要初始化 |
||
|
||
const handleMouseEnter = () => { | ||
setIsHovered(true); | ||
|
@@ -137,7 +139,7 @@ function TopBanner() { | |
|
||
const handleClose = () => { | ||
setIsVisible(false); | ||
localStorage.setItem("bannerDismissed", "true"); | ||
storage.setItem("bannerDismissed", "true"); | ||
}; | ||
|
||
if (!isVisible) { | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
|
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
放外面