verify
This commit is contained in:
@@ -15,11 +15,12 @@ export function buildFullPostCaption(
|
||||
billboards: SelectedPostLink[],
|
||||
lang?: AppLanguage,
|
||||
shops: SelectedPostLink[] = [],
|
||||
shopProducts: SelectedPostLink[] = []
|
||||
shopProducts: SelectedPostLink[] = [],
|
||||
bookings: SelectedPostLink[] = []
|
||||
): string {
|
||||
const tagLine = taggedUsers.map((u) => `@${u.user_name}`).join(" ");
|
||||
const linkHeader = buildPostLinkCaptionHeader(
|
||||
[...packages, ...projects, ...billboards, ...shops, ...shopProducts],
|
||||
[...packages, ...projects, ...billboards, ...shops, ...shopProducts, ...bookings],
|
||||
lang
|
||||
);
|
||||
return [description.trim(), tagLine, linkHeader].filter(Boolean).join("\n");
|
||||
@@ -33,7 +34,8 @@ export function countPostCaptionLength(
|
||||
billboards: SelectedPostLink[],
|
||||
lang?: AppLanguage,
|
||||
shops: SelectedPostLink[] = [],
|
||||
shopProducts: SelectedPostLink[] = []
|
||||
shopProducts: SelectedPostLink[] = [],
|
||||
bookings: SelectedPostLink[] = []
|
||||
): number {
|
||||
return buildFullPostCaption(
|
||||
description,
|
||||
@@ -43,6 +45,7 @@ export function countPostCaptionLength(
|
||||
billboards,
|
||||
lang,
|
||||
shops,
|
||||
shopProducts
|
||||
shopProducts,
|
||||
bookings
|
||||
).length;
|
||||
}
|
||||
|
||||
28
src/lib/glassBackdrop.ts
Normal file
28
src/lib/glassBackdrop.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { CSSProperties } from "react";
|
||||
|
||||
/**
|
||||
* Turbopack's Tailwind v4 (Lightning CSS) pipeline silently strips hand-authored
|
||||
* `backdrop-filter`/`-webkit-backdrop-filter` declarations from globals.css classes
|
||||
* in this project (confirmed via computed-style + compiled-stylesheet inspection —
|
||||
* the class survives with every other declaration except backdrop-filter).
|
||||
* Inline styles bypass that pipeline entirely, so every glass-* class gets its
|
||||
* matching blur/saturate re-applied here as a companion inline style.
|
||||
*/
|
||||
export const GLASS_BACKDROP: Record<string, CSSProperties> = {
|
||||
"glass-panel": { backdropFilter: "blur(20px) saturate(180%)", WebkitBackdropFilter: "blur(20px) saturate(180%)" },
|
||||
"chat-header-glass": { backdropFilter: "blur(20px) saturate(180%)", WebkitBackdropFilter: "blur(20px) saturate(180%)" },
|
||||
"chat-timer-glass": { backdropFilter: "blur(20px) saturate(180%)", WebkitBackdropFilter: "blur(20px) saturate(180%)" },
|
||||
"chat-timer-badge-glass": { backdropFilter: "blur(10px) saturate(160%)", WebkitBackdropFilter: "blur(10px) saturate(160%)" },
|
||||
"glass-chat-input": { backdropFilter: "blur(24px) saturate(200%)", WebkitBackdropFilter: "blur(24px) saturate(200%)" },
|
||||
"glass-panel-strong": { backdropFilter: "blur(24px) saturate(1.4)", WebkitBackdropFilter: "blur(24px) saturate(1.4)" },
|
||||
"comments-modal-glass": { backdropFilter: "blur(28px) saturate(1.5)", WebkitBackdropFilter: "blur(28px) saturate(1.5)" },
|
||||
"tab-active-glass": { backdropFilter: "blur(12px)", WebkitBackdropFilter: "blur(12px)" },
|
||||
"glass-modal-overlay": { backdropFilter: "blur(20px) saturate(120%)", WebkitBackdropFilter: "blur(20px) saturate(120%)" },
|
||||
"glass-modal-overlay--dark": { backdropFilter: "blur(24px) saturate(110%)", WebkitBackdropFilter: "blur(24px) saturate(110%)" },
|
||||
"glass-modal-panel": { backdropFilter: "blur(28px) saturate(180%)", WebkitBackdropFilter: "blur(28px) saturate(180%)" },
|
||||
};
|
||||
|
||||
/** Returns the inline backdrop-filter style for a known glass-* class name, merged if multiple apply. */
|
||||
export function glassBackdropStyle(...classNames: string[]): CSSProperties {
|
||||
return Object.assign({}, ...classNames.map((c) => GLASS_BACKDROP[c]).filter(Boolean));
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import { DEFAULT_LANGUAGE, type AppLanguage } from "@/lib/i18n/registry";
|
||||
|
||||
export type PostLinkKind = "pkg" | "project" | "billboard" | "shop" | "shopproduct";
|
||||
export type PostLinkKind = "pkg" | "project" | "billboard" | "shop" | "shopproduct" | "booking";
|
||||
|
||||
/** مارکر لینک داخل کپشن */
|
||||
export const POST_LINK_TOKEN_REGEX =
|
||||
/\[\[(pkg|project|billboard|shop|shopproduct):([a-f0-9]{24})\]\]([\s\S]*?)\[\[\/\1\]\]/gi;
|
||||
/\[\[(pkg|project|billboard|shop|shopproduct|booking):([a-f0-9]{24})\]\]([\s\S]*?)\[\[\/\1\]\]/gi;
|
||||
|
||||
/** @deprecated use POST_LINK_TOKEN_REGEX */
|
||||
export const POST_PACKAGE_TOKEN_REGEX =
|
||||
@@ -21,6 +21,7 @@ const FA_LINK_LABELS = {
|
||||
billboard: "بیلبورد",
|
||||
shop: "فروشگاه",
|
||||
shopproduct: "کالا",
|
||||
booking: "رزرو نوبت",
|
||||
} as const;
|
||||
|
||||
const EN_LINK_LABELS = {
|
||||
@@ -29,6 +30,7 @@ const EN_LINK_LABELS = {
|
||||
billboard: "Billboard",
|
||||
shop: "Shop",
|
||||
shopproduct: "Product",
|
||||
booking: "Booking",
|
||||
} as const;
|
||||
|
||||
export function getPostLinkLabels(lang: AppLanguage = DEFAULT_LANGUAGE) {
|
||||
@@ -61,6 +63,8 @@ export function buildPostLinkPath(
|
||||
return `/shops/profile/${id}`;
|
||||
case "shopproduct":
|
||||
return `/shops/listing/${id}`;
|
||||
case "booking":
|
||||
return `/booking/${id}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,13 +91,14 @@ export function buildPostLinkCaptionHeader(
|
||||
billboard: [],
|
||||
shop: [],
|
||||
shopproduct: [],
|
||||
booking: [],
|
||||
};
|
||||
for (const link of list) {
|
||||
groups[link.kind].push(link);
|
||||
}
|
||||
|
||||
const parts: string[] = [];
|
||||
(["pkg", "project", "billboard", "shop", "shopproduct"] as const).forEach((kind) => {
|
||||
(["pkg", "project", "billboard", "shop", "shopproduct", "booking"] as const).forEach((kind) => {
|
||||
if (!groups[kind].length) return;
|
||||
const tokens = groups[kind]
|
||||
.map((l) => buildPostLinkCaptionToken(l.kind, l._id, l.title))
|
||||
|
||||
Reference in New Issue
Block a user