mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
update avatars
This commit is contained in:
1 parent
61abddc41b
commit
9536cd2d39
2 files changed
+9
-8
No files matched your search
@@ -77,7 +77,7 @@ function Details({ avatars }: DetailsProps) {
|
|||||||
<div
|
<div
|
||||||
className={styles.image}
|
className={styles.image}
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(/api/avatars/${avatar.name}.webp)`,
|
backgroundImage: `url(/media/avatars/${avatar.id}.webp)`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Badge
|
<Badge
|
||||||
@@ -102,7 +102,7 @@ function Details({ avatars }: DetailsProps) {
|
|||||||
|
|
||||||
<Link
|
<Link
|
||||||
underline="never"
|
underline="never"
|
||||||
href={`/api/avatars/${avatar.name}.webp`}
|
href={`/media/avatars/${avatar.id}.webp`}
|
||||||
download
|
download
|
||||||
>
|
>
|
||||||
<Button>
|
<Button>
|
||||||
@@ -128,7 +128,7 @@ function Series(props: PropsWithSkeleton<SeriesProps>) {
|
|||||||
{!props.skeleton &&
|
{!props.skeleton &&
|
||||||
props.avatars.slice(-MAX_CARDS).map((avatar, index) => (
|
props.avatars.slice(-MAX_CARDS).map((avatar, index) => (
|
||||||
<div
|
<div
|
||||||
key={avatar.name}
|
key={avatar.id}
|
||||||
className={styles.entry}
|
className={styles.entry}
|
||||||
style={{
|
style={{
|
||||||
filter: `brightness(${(index + 1) / count})`,
|
filter: `brightness(${(index + 1) / count})`,
|
||||||
@@ -136,7 +136,7 @@ function Series(props: PropsWithSkeleton<SeriesProps>) {
|
|||||||
left: `calc(${index} * ${CARD_TRIM})`,
|
left: `calc(${index} * ${CARD_TRIM})`,
|
||||||
width: `calc(100% - ${CARD_TRIM} * ${count - 1})`,
|
width: `calc(100% - ${CARD_TRIM} * ${count - 1})`,
|
||||||
height: `calc(100% - ${CARD_TRIM} * ${count - 1})`,
|
height: `calc(100% - ${CARD_TRIM} * ${count - 1})`,
|
||||||
backgroundImage: `url(/api/avatars/${avatar.name}.webp)`,
|
backgroundImage: `url(/media/avatars/${avatar.id}.webp)`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import type { Avatar } from "@protos/avatar";
|
||||||
import fuzzysort from "fuzzysort";
|
import fuzzysort from "fuzzysort";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { api } from "../../api/dynamic";
|
import { api } from "../../api/dynamic";
|
||||||
import { useAwait } from "../../hooks/useAwait";
|
import { useAwait } from "../../hooks/useAwait";
|
||||||
import { useGameStrings } from "../../hooks/useGameStrings";
|
import { useGameStrings } from "../../hooks/useGameStrings";
|
||||||
import { useLocale } from "../../hooks/useLocale";
|
import { useLocale } from "../../hooks/useLocale";
|
||||||
import type { Avatar } from "../../protos/avatar";
|
|
||||||
import { Avatars } from "../../stores/avatars";
|
import { Avatars } from "../../stores/avatars";
|
||||||
import { AvatarCard } from "../AvatarCard";
|
import { AvatarCard } from "../AvatarCard";
|
||||||
import { IncrementalLoader } from "../IncrementalLoader";
|
import { IncrementalLoader } from "../IncrementalLoader";
|
||||||
@@ -12,7 +12,7 @@ import "./index.css";
|
|||||||
|
|
||||||
const { go } = fuzzysort;
|
const { go } = fuzzysort;
|
||||||
|
|
||||||
const indexingPattern = /.+_(\d+)$/;
|
const indexingPattern = /ProfileAvatarEntity\..+_(\d+)$/;
|
||||||
|
|
||||||
export function AvatarsList() {
|
export function AvatarsList() {
|
||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
@@ -38,6 +38,7 @@ export function AvatarsList() {
|
|||||||
}, []);
|
}, []);
|
||||||
const ordered = useMemo(() => {
|
const ordered = useMemo(() => {
|
||||||
const array = Array.from(groups.entries());
|
const array = Array.from(groups.entries());
|
||||||
|
|
||||||
return array
|
return array
|
||||||
.sort((a, b) => a[0].localeCompare(b[0], locale))
|
.sort((a, b) => a[0].localeCompare(b[0], locale))
|
||||||
.map(([name, avatars]) => ({
|
.map(([name, avatars]) => ({
|
||||||
@@ -49,8 +50,8 @@ export function AvatarsList() {
|
|||||||
let diff = gradeA - gradeB;
|
let diff = gradeA - gradeB;
|
||||||
|
|
||||||
if (diff === 0) {
|
if (diff === 0) {
|
||||||
const matchesA = a.name.match(indexingPattern);
|
const matchesA = a.id.match(indexingPattern);
|
||||||
const matchesB = b.name.match(indexingPattern);
|
const matchesB = b.id.match(indexingPattern);
|
||||||
|
|
||||||
if (matchesA && matchesB) {
|
if (matchesA && matchesB) {
|
||||||
const indexA = Number(matchesA[1]);
|
const indexA = Number(matchesA[1]);
|
||||||
|
|||||||
Reference in new issue
Block a user