Commit 3dc23e79 authored by Lê Bảo Hồng Đức's avatar Lê Bảo Hồng Đức

[tag]0.1-vcci

parents dfa17dc9 40d4b3f5
Pipeline #52519 passed with stages
in 3 minutes and 50 seconds
...@@ -13,7 +13,6 @@ const FALLBACK_HREF = "https://vccihcm.vn"; ...@@ -13,7 +13,6 @@ const FALLBACK_HREF = "https://vccihcm.vn";
function AdItem({ item }: { item: Advertisement }) { function AdItem({ item }: { item: Advertisement }) {
const initialSrc = item.file?.path ? resolveUploadUrl(item.file.path) : FALLBACK_SRC; const initialSrc = item.file?.path ? resolveUploadUrl(item.file.path) : FALLBACK_SRC;
const [src, setSrc] = useState(initialSrc); const [src, setSrc] = useState(initialSrc);
const isGif = src.toLowerCase().endsWith(".gif");
return ( return (
<Link <Link
...@@ -30,7 +29,7 @@ function AdItem({ item }: { item: Advertisement }) { ...@@ -30,7 +29,7 @@ function AdItem({ item }: { item: Advertisement }) {
width={2048} width={2048}
height={1365} height={1365}
className="h-full w-full object-cover object-[center_80%]" className="h-full w-full object-cover object-[center_80%]"
unoptimized={isGif} unoptimized
onError={() => { onError={() => {
if (src !== FALLBACK_SRC) setSrc(FALLBACK_SRC); if (src !== FALLBACK_SRC) setSrc(FALLBACK_SRC);
}} }}
......
...@@ -16,7 +16,7 @@ export function useAdvertisements( ...@@ -16,7 +16,7 @@ export function useAdvertisements(
type: "square" | "horizontal", type: "square" | "horizontal",
limit?: number, limit?: number,
): Advertisement[] { ): Advertisement[] {
const effectiveLimit = limit ?? (type === "horizontal" ? 1 : 20); const effectiveLimit = limit ?? (type === "horizontal" ? 1 : 5);
const { data } = useGetApiV10AdvertisementPublic({ const { data } = useGetApiV10AdvertisementPublic({
type: type as GetApiV10AdvertisementPublicType, type: type as GetApiV10AdvertisementPublicType,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment