refactor(ui): redesign SearchBar with compact mode and add home screen tabs
Refactor SearchBar component to support compact mode with transparent styling, reduced padding, and smaller icons. Add home screen tab navigation for switching between home feed and market view with animated tab indicator. Also adjust PostDetailScreen action button sizing and CommentItem margins for better spacing.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
export * from './dto';
|
||||
export * from './schedule';
|
||||
export * from './material';
|
||||
export * from './trade';
|
||||
|
||||
// 兼容旧类型(用于内部组件)
|
||||
import type {
|
||||
|
||||
124
src/types/trade.ts
Normal file
124
src/types/trade.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
export type TradeType = 'sell' | 'buy';
|
||||
export type TradeCategory = 'digital' | 'book' | 'clothing' | 'daily' | 'cosmetics' | 'sport' | 'ticket' | 'other';
|
||||
export type TradeItemStatus = 'active' | 'sold' | 'bought' | 'offline' | 'deleted';
|
||||
export type TradeCondition = 'brand_new' | 'like_new' | 'lightly_used' | 'well_used';
|
||||
|
||||
export interface TradeImageDTO {
|
||||
id: string;
|
||||
url: string;
|
||||
thumbnail_url: string;
|
||||
preview_url: string;
|
||||
preview_url_large: string;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface TradeItemDTO {
|
||||
id: string;
|
||||
user_id: string;
|
||||
trade_type: TradeType;
|
||||
category: TradeCategory;
|
||||
title: string;
|
||||
content: string;
|
||||
segments?: any[];
|
||||
images: TradeImageDTO[];
|
||||
price?: number | null;
|
||||
condition?: string;
|
||||
status: TradeItemStatus;
|
||||
views_count: number;
|
||||
favorites_count: number;
|
||||
wants_count?: number;
|
||||
comments_count?: number;
|
||||
is_favorited: boolean;
|
||||
is_free_shipping?: boolean;
|
||||
is_quick_ship?: boolean;
|
||||
is_negotiable?: boolean;
|
||||
is_self_pickup?: boolean;
|
||||
good_reputation?: number;
|
||||
brand?: string;
|
||||
function_status?: string;
|
||||
promo_text?: string;
|
||||
author: any | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export type TradeItemDetailDTO = TradeItemDTO;
|
||||
|
||||
export interface CreateTradeItemInput {
|
||||
trade_type: TradeType;
|
||||
category: TradeCategory;
|
||||
title: string;
|
||||
content?: string;
|
||||
segments?: any[];
|
||||
images?: string[];
|
||||
price?: number | null;
|
||||
condition?: TradeCondition;
|
||||
}
|
||||
|
||||
export interface UpdateTradeItemInput {
|
||||
trade_type?: TradeType;
|
||||
category?: TradeCategory;
|
||||
title?: string;
|
||||
content?: string;
|
||||
segments?: any[];
|
||||
images?: string[];
|
||||
price?: number | null;
|
||||
condition?: TradeCondition;
|
||||
}
|
||||
|
||||
export interface TradeCursorPageResponse {
|
||||
list: TradeItemDTO[];
|
||||
next_cursor?: string;
|
||||
prev_cursor?: string;
|
||||
has_more: boolean;
|
||||
}
|
||||
|
||||
export const TRADE_CATEGORY_MAP: Record<TradeCategory, string> = {
|
||||
digital: '数码电子',
|
||||
book: '书籍教材',
|
||||
clothing: '服饰鞋包',
|
||||
daily: '日用百货',
|
||||
cosmetics: '美妆护肤',
|
||||
sport: '运动户外',
|
||||
ticket: '票券卡券',
|
||||
other: '其他',
|
||||
};
|
||||
|
||||
export const TRADE_CONDITION_MAP: Record<TradeCondition, string> = {
|
||||
brand_new: '全新',
|
||||
like_new: '几乎全新',
|
||||
lightly_used: '轻微使用痕迹',
|
||||
well_used: '明显使用痕迹',
|
||||
};
|
||||
|
||||
export const TRADE_TYPE_MAP: Record<TradeType, string> = {
|
||||
sell: '出售',
|
||||
buy: '收购',
|
||||
};
|
||||
|
||||
export const TRADE_STATUS_MAP: Record<TradeItemStatus, string> = {
|
||||
active: '在售',
|
||||
sold: '已售出',
|
||||
bought: '已收得',
|
||||
offline: '已下架',
|
||||
deleted: '已删除',
|
||||
};
|
||||
|
||||
export const ALL_TRADE_CATEGORIES: { key: TradeCategory; label: string }[] = [
|
||||
{ key: 'digital', label: '数码电子' },
|
||||
{ key: 'book', label: '书籍教材' },
|
||||
{ key: 'clothing', label: '服饰鞋包' },
|
||||
{ key: 'daily', label: '日用百货' },
|
||||
{ key: 'cosmetics', label: '美妆护肤' },
|
||||
{ key: 'sport', label: '运动户外' },
|
||||
{ key: 'ticket', label: '票券卡券' },
|
||||
{ key: 'other', label: '其他' },
|
||||
];
|
||||
|
||||
export const ALL_TRADE_CONDITIONS: { key: TradeCondition; label: string }[] = [
|
||||
{ key: 'brand_new', label: '全新' },
|
||||
{ key: 'like_new', label: '几乎全新' },
|
||||
{ key: 'lightly_used', label: '轻微使用痕迹' },
|
||||
{ key: 'well_used', label: '明显使用痕迹' },
|
||||
];
|
||||
Reference in New Issue
Block a user