Skip to content

Commit

Permalink
i18n: sync page
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbenben committed Sep 5, 2024
1 parent d6adf9f commit 07a2105
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 60 deletions.
26 changes: 21 additions & 5 deletions i18n/ar/docusaurus-plugin-content-pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
{/* 登陆用户标签按钮 */}
{userAuth && (
<>
<li className={styles.checkboxListItem} onClick={handleUserPrompts}>
<li className={`${styles.checkboxListItem} ${showUserPrompts ? styles.activeItem : ""}`} onClick={handleUserPrompts}>
<ShowcaseTooltip
text={translate({
id: "myprompt.tooltip",
Expand All @@ -184,7 +184,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
/>
</ShowcaseTooltip>
</li>
<li className={styles.checkboxListItem} onClick={handleUserFavs}>
<li className={`${styles.checkboxListItem} ${showUserFavs ? styles.activeItem : ""}`} onClick={handleUserFavs}>
<ShowcaseTooltip
text={translate({
id: "myfavorite.tooltip",
Expand Down Expand Up @@ -272,13 +272,27 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
</ShowcaseTooltip>
</li>
</ul>
{showUserPrompts && <UserPrompts />}
{showUserFavs && <UserFavorite />}
{showUserPrompts && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserPrompts />
</>
)}
{showUserFavs && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserFavorite />
</>
)}
</section>
);
}

function SearchBar() {
function SearchBar({ setShowUserPrompts = (value) => {}, setShowUserFavs = (value) => {} }) {
const history = useHistory();
const location = useLocation();
const searchRef = useRef<HTMLInputElement>(null);
Expand All @@ -303,6 +317,8 @@ function SearchBar() {
search: newSearch.toString(),
state: prepareUserState(),
});
setShowUserPrompts(false);
setShowUserFavs(false);
}, 1000), // search latency 搜索延时
[location, history]
);
Expand Down
26 changes: 21 additions & 5 deletions i18n/bn/docusaurus-plugin-content-pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
{/* 登陆用户标签按钮 */}
{userAuth && (
<>
<li className={styles.checkboxListItem} onClick={handleUserPrompts}>
<li className={`${styles.checkboxListItem} ${showUserPrompts ? styles.activeItem : ""}`} onClick={handleUserPrompts}>
<ShowcaseTooltip
text={translate({
id: "myprompt.tooltip",
Expand All @@ -184,7 +184,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
/>
</ShowcaseTooltip>
</li>
<li className={styles.checkboxListItem} onClick={handleUserFavs}>
<li className={`${styles.checkboxListItem} ${showUserFavs ? styles.activeItem : ""}`} onClick={handleUserFavs}>
<ShowcaseTooltip
text={translate({
id: "myfavorite.tooltip",
Expand Down Expand Up @@ -272,13 +272,27 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
</ShowcaseTooltip>
</li>
</ul>
{showUserPrompts && <UserPrompts />}
{showUserFavs && <UserFavorite />}
{showUserPrompts && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserPrompts />
</>
)}
{showUserFavs && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserFavorite />
</>
)}
</section>
);
}

function SearchBar() {
function SearchBar({ setShowUserPrompts = (value) => {}, setShowUserFavs = (value) => {} }) {
const history = useHistory();
const location = useLocation();
const searchRef = useRef<HTMLInputElement>(null);
Expand All @@ -303,6 +317,8 @@ function SearchBar() {
search: newSearch.toString(),
state: prepareUserState(),
});
setShowUserPrompts(false);
setShowUserFavs(false);
}, 1000), // search latency 搜索延时
[location, history]
);
Expand Down
26 changes: 21 additions & 5 deletions i18n/de/docusaurus-plugin-content-pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
{/* 登陆用户标签按钮 */}
{userAuth && (
<>
<li className={styles.checkboxListItem} onClick={handleUserPrompts}>
<li className={`${styles.checkboxListItem} ${showUserPrompts ? styles.activeItem : ""}`} onClick={handleUserPrompts}>
<ShowcaseTooltip
text={translate({
id: "myprompt.tooltip",
Expand All @@ -184,7 +184,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
/>
</ShowcaseTooltip>
</li>
<li className={styles.checkboxListItem} onClick={handleUserFavs}>
<li className={`${styles.checkboxListItem} ${showUserFavs ? styles.activeItem : ""}`} onClick={handleUserFavs}>
<ShowcaseTooltip
text={translate({
id: "myfavorite.tooltip",
Expand Down Expand Up @@ -272,13 +272,27 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
</ShowcaseTooltip>
</li>
</ul>
{showUserPrompts && <UserPrompts />}
{showUserFavs && <UserFavorite />}
{showUserPrompts && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserPrompts />
</>
)}
{showUserFavs && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserFavorite />
</>
)}
</section>
);
}

function SearchBar() {
function SearchBar({ setShowUserPrompts = (value) => {}, setShowUserFavs = (value) => {} }) {
const history = useHistory();
const location = useLocation();
const searchRef = useRef<HTMLInputElement>(null);
Expand All @@ -303,6 +317,8 @@ function SearchBar() {
search: newSearch.toString(),
state: prepareUserState(),
});
setShowUserPrompts(false);
setShowUserFavs(false);
}, 1000), // search latency 搜索延时
[location, history]
);
Expand Down
26 changes: 21 additions & 5 deletions i18n/en/docusaurus-plugin-content-pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
{/* 登陆用户标签按钮 */}
{userAuth && (
<>
<li className={styles.checkboxListItem} onClick={handleUserPrompts}>
<li className={`${styles.checkboxListItem} ${showUserPrompts ? styles.activeItem : ""}`} onClick={handleUserPrompts}>
<ShowcaseTooltip
text={translate({
id: "myprompt.tooltip",
Expand All @@ -184,7 +184,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
/>
</ShowcaseTooltip>
</li>
<li className={styles.checkboxListItem} onClick={handleUserFavs}>
<li className={`${styles.checkboxListItem} ${showUserFavs ? styles.activeItem : ""}`} onClick={handleUserFavs}>
<ShowcaseTooltip
text={translate({
id: "myfavorite.tooltip",
Expand Down Expand Up @@ -272,13 +272,27 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
</ShowcaseTooltip>
</li>
</ul>
{showUserPrompts && <UserPrompts />}
{showUserFavs && <UserFavorite />}
{showUserPrompts && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserPrompts />
</>
)}
{showUserFavs && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserFavorite />
</>
)}
</section>
);
}

function SearchBar() {
function SearchBar({ setShowUserPrompts = (value) => {}, setShowUserFavs = (value) => {} }) {
const history = useHistory();
const location = useLocation();
const searchRef = useRef<HTMLInputElement>(null);
Expand All @@ -303,6 +317,8 @@ function SearchBar() {
search: newSearch.toString(),
state: prepareUserState(),
});
setShowUserPrompts(false);
setShowUserFavs(false);
}, 1000), // search latency 搜索延时
[location, history]
);
Expand Down
26 changes: 21 additions & 5 deletions i18n/es/docusaurus-plugin-content-pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
{/* 登陆用户标签按钮 */}
{userAuth && (
<>
<li className={styles.checkboxListItem} onClick={handleUserPrompts}>
<li className={`${styles.checkboxListItem} ${showUserPrompts ? styles.activeItem : ""}`} onClick={handleUserPrompts}>
<ShowcaseTooltip
text={translate({
id: "myprompt.tooltip",
Expand All @@ -184,7 +184,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
/>
</ShowcaseTooltip>
</li>
<li className={styles.checkboxListItem} onClick={handleUserFavs}>
<li className={`${styles.checkboxListItem} ${showUserFavs ? styles.activeItem : ""}`} onClick={handleUserFavs}>
<ShowcaseTooltip
text={translate({
id: "myfavorite.tooltip",
Expand Down Expand Up @@ -272,13 +272,27 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
</ShowcaseTooltip>
</li>
</ul>
{showUserPrompts && <UserPrompts />}
{showUserFavs && <UserFavorite />}
{showUserPrompts && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserPrompts />
</>
)}
{showUserFavs && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserFavorite />
</>
)}
</section>
);
}

function SearchBar() {
function SearchBar({ setShowUserPrompts = (value) => {}, setShowUserFavs = (value) => {} }) {
const history = useHistory();
const location = useLocation();
const searchRef = useRef<HTMLInputElement>(null);
Expand All @@ -303,6 +317,8 @@ function SearchBar() {
search: newSearch.toString(),
state: prepareUserState(),
});
setShowUserPrompts(false);
setShowUserFavs(false);
}, 1000), // search latency 搜索延时
[location, history]
);
Expand Down
26 changes: 21 additions & 5 deletions i18n/fr/docusaurus-plugin-content-pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
{/* 登陆用户标签按钮 */}
{userAuth && (
<>
<li className={styles.checkboxListItem} onClick={handleUserPrompts}>
<li className={`${styles.checkboxListItem} ${showUserPrompts ? styles.activeItem : ""}`} onClick={handleUserPrompts}>
<ShowcaseTooltip
text={translate({
id: "myprompt.tooltip",
Expand All @@ -184,7 +184,7 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
/>
</ShowcaseTooltip>
</li>
<li className={styles.checkboxListItem} onClick={handleUserFavs}>
<li className={`${styles.checkboxListItem} ${showUserFavs ? styles.activeItem : ""}`} onClick={handleUserFavs}>
<ShowcaseTooltip
text={translate({
id: "myfavorite.tooltip",
Expand Down Expand Up @@ -272,13 +272,27 @@ function ShowcaseFilters({ onToggleDescription, showUserFavs, setShowUserFavs })
</ShowcaseTooltip>
</li>
</ul>
{showUserPrompts && <UserPrompts />}
{showUserFavs && <UserFavorite />}
{showUserPrompts && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserPrompts />
</>
)}
{showUserFavs && (
<>
<div className={clsx("margin-bottom--md", styles.showcaseFavoriteHeader)}>
<SearchBar setShowUserPrompts={setShowUserPrompts} setShowUserFavs={setShowUserFavs} />
</div>
<UserFavorite />
</>
)}
</section>
);
}

function SearchBar() {
function SearchBar({ setShowUserPrompts = (value) => {}, setShowUserFavs = (value) => {} }) {
const history = useHistory();
const location = useLocation();
const searchRef = useRef<HTMLInputElement>(null);
Expand All @@ -303,6 +317,8 @@ function SearchBar() {
search: newSearch.toString(),
state: prepareUserState(),
});
setShowUserPrompts(false);
setShowUserFavs(false);
}, 1000), // search latency 搜索延时
[location, history]
);
Expand Down
Loading

0 comments on commit 07a2105

Please sign in to comment.