add funnel

This commit is contained in:
dev.daminik00 2025-10-05 23:43:14 +02:00 committed by gofnnp
parent fba0acaf0b
commit a600638276
2 changed files with 26 additions and 9 deletions

View File

@ -0,0 +1,13 @@
<svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M40 0C62.0914 0 80 17.9086 80 40C80 62.0914 62.0914 80 40 80C17.9086 80 0 62.0914 0 40C0 17.9086 17.9086 0 40 0Z" fill="url(#paint0_linear_116_2792)"/>
<path d="M40 0C62.0914 0 80 17.9086 80 40C80 62.0914 62.0914 80 40 80C17.9086 80 0 62.0914 0 40C0 17.9086 17.9086 0 40 0Z" stroke="#E5E7EB"/>
<path d="M55 58H25V22H55V58Z" stroke="#E5E7EB"/>
<path d="M55 54.75H25V24.75H55V54.75Z" stroke="#E5E7EB"/>
<path d="M27.7891 42.3515L38.377 52.2363C38.8164 52.6464 39.3965 52.8749 40 52.8749C40.6035 52.8749 41.1836 52.6464 41.623 52.2363L52.2109 42.3515C53.9922 40.6933 55 38.3671 55 35.9355V35.5957C55 31.4999 52.041 28.0078 48.0039 27.3339C45.332 26.8886 42.6133 27.7617 40.7031 29.6718L40 30.3749L39.2969 29.6718C37.3867 27.7617 34.668 26.8886 31.9961 27.3339C27.959 28.0078 25 31.4999 25 35.5957V35.9355C25 38.3671 26.0078 40.6933 27.7891 42.3515Z" fill="#EC4899"/>
<defs>
<linearGradient id="paint0_linear_116_2792" x1="0" y1="40" x2="80" y2="40" gradientUnits="userSpaceOnUse">
<stop stop-color="#FCE7F3"/>
<stop offset="1" stop-color="#F3E8FF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -35,19 +35,18 @@ export interface IFunnel extends Document {
// Вложенные схемы для валидации структуры данных воронки
const TypographyVariantSchema = new Schema(
{
text: {
text: {
type: String,
// НЕ required - позволяет { show: false } без текста
// НЕ required позволяет { show: false } без текста, но если указан — не пустой
validate: {
validator: function(v: string | undefined): boolean {
// Если текст указан, он не может быть пустым
validator: function (v: string | undefined): boolean {
if (v === undefined || v === null) return true;
return v.trim().length > 0;
},
message: 'Text field cannot be empty if provided'
}
message: "Text field cannot be empty if provided",
},
},
show: { type: Boolean, default: true }, // Добавляем поддержку show флага
show: { type: Boolean, default: true }, // поддержка флага видимости
font: {
type: String,
enum: ["manrope", "inter", "geistSans", "geistMono"],
@ -376,9 +375,14 @@ FunnelSchema.pre("save", function (next) {
// Экспорт модели с проверкой на существование
// В dev окружении пересоздаём модель, чтобы подтянуть изменения схемы (enums и т.п.)
if (process.env.NODE_ENV !== "production" && typeof mongoose.models.Funnel !== "undefined") {
if (
process.env.NODE_ENV !== "production" &&
typeof mongoose.models.Funnel !== "undefined"
) {
try {
(mongoose as unknown as { deleteModel: (name: string) => void }).deleteModel("Funnel");
(
mongoose as unknown as { deleteModel: (name: string) => void }
).deleteModel("Funnel");
} catch {
// no-op
}