新增:首页列表

This commit is contained in:
ivan 2026-02-04 21:36:51 +08:00
parent 7ceb5c4e38
commit bfe52f4db4
2 changed files with 154 additions and 117 deletions

View File

@ -1,14 +1,17 @@
<template> <template>
<v-card class="market-card" elevation="0" :rounded="'lg'"> <v-card class="market-card" elevation="0" :rounded="'lg'">
<!-- Market Image --> <div class="market-card-content">
<!-- Top Section -->
<div class="top-section">
<!-- Market Image and Title -->
<div class="image-title-container">
<v-avatar class="market-image" :size="40" :color="'#f0f0f0'" :rounded="'sm'"> <v-avatar class="market-image" :size="40" :color="'#f0f0f0'" :rounded="'sm'">
<!-- Placeholder for market image --> <!-- Placeholder for market image -->
</v-avatar> </v-avatar>
<!-- Market Title -->
<v-card-title class="market-title" :text="true" :shrink="true"> <v-card-title class="market-title" :text="true" :shrink="true">
{{ marketTitle }} {{ marketTitle }}
</v-card-title> </v-card-title>
</div>
<!-- Chance Container --> <!-- Chance Container -->
<div class="chance-container"> <div class="chance-container">
@ -26,33 +29,27 @@
</v-progress-circular> </v-progress-circular>
<span class="chance-label">chance</span> <span class="chance-label">chance</span>
</div> </div>
</div>
<!-- Options --> <!-- Options Section -->
<v-btn <div class="options-section">
class="option-yes" <v-btn class="option-yes" :color="'#e6f9e6'" :rounded="'sm'" :text="true">
:width="140"
:height="40"
:color="'#e6f9e6'"
:rounded="'sm'"
:text="true"
>
<span class="option-text-yes">Yes</span> <span class="option-text-yes">Yes</span>
</v-btn> </v-btn>
<v-btn <v-btn class="option-no" :color="'#ffe6e6'" :rounded="'sm'" :text="true">
class="option-no"
:width="140"
:height="40"
:color="'#ffe6e6'"
:rounded="'sm'"
:text="true"
>
<span class="option-text-no">No</span> <span class="option-text-no">No</span>
</v-btn> </v-btn>
</div>
<!-- Market Info --> <!-- Bottom Section -->
<div class="bottom-section">
<span class="market-info">{{ marketInfo }}</span> <span class="market-info">{{ marketInfo }}</span>
<div class="icons-container">
<v-icon class="gift-icon" size="16">mdi-gift</v-icon> <v-icon class="gift-icon" size="16">mdi-gift</v-icon>
<v-icon class="bookmark-icon" size="16">mdi-bookmark</v-icon> <v-icon class="bookmark-icon" size="16">mdi-bookmark</v-icon>
</div>
</div>
</div>
</v-card> </v-card>
</template> </template>
@ -90,20 +87,38 @@ const progressColor = computed(() => {
background-color: #ffffff; background-color: #ffffff;
border-radius: 8px; border-radius: 8px;
border: 1px solid #e7e7e7; border: 1px solid #e7e7e7;
padding: 12px;
}
.market-card-content {
display: flex;
flex-direction: column;
height: 100%;
gap: 12px;
}
/* Top Section */
.top-section {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.image-title-container {
display: flex;
align-items: flex-start;
gap: 12px;
flex: 1;
min-width: 0;
} }
.market-image { .market-image {
position: absolute; flex-shrink: 0;
left: 12px;
top: 12px;
} }
.market-title { .market-title {
position: absolute; flex: 1;
left: 60px; min-width: 0;
top: 12px;
width: 180px;
max-height: 32px;
font-family: 'Inter', sans-serif; font-family: 'Inter', sans-serif;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
@ -116,14 +131,12 @@ const progressColor = computed(() => {
} }
.chance-container { .chance-container {
position: absolute;
left: 248px;
top: 10px;
width: 60px;
height: 60px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
flex-shrink: 0;
width: 60px;
height: 60px;
} }
.progress-bar { .progress-bar {
@ -145,11 +158,16 @@ const progressColor = computed(() => {
margin-top: 4px; margin-top: 4px;
} }
/* Options Section */
.options-section {
display: flex;
gap: 12px;
}
.option-yes { .option-yes {
position: absolute; flex: 1;
left: 12px;
top: 72px;
background-color: #e6f9e6; background-color: #e6f9e6;
height: 40px;
} }
.option-text-yes { .option-text-yes {
@ -160,10 +178,9 @@ const progressColor = computed(() => {
} }
.option-no { .option-no {
position: absolute; flex: 1;
left: 158px;
top: 72px;
background-color: #ffe6e6; background-color: #ffe6e6;
height: 40px;
} }
.option-text-no { .option-text-no {
@ -173,27 +190,31 @@ const progressColor = computed(() => {
color: #ff0000; color: #ff0000;
} }
/* Bottom Section */
.bottom-section {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: auto;
}
.market-info { .market-info {
position: absolute;
left: 12px;
top: 124px;
font-family: 'Inter', sans-serif; font-family: 'Inter', sans-serif;
font-size: 12px; font-size: 12px;
font-weight: normal; font-weight: normal;
color: #808080; color: #808080;
} }
.icons-container {
display: flex;
gap: 16px;
}
.gift-icon { .gift-icon {
position: absolute;
left: 240px;
top: 124px;
color: #808080; color: #808080;
} }
.bookmark-icon { .bookmark-icon {
position: absolute;
left: 270px;
top: 124px;
color: #808080; color: #808080;
} }
</style> </style>

View File

@ -1,47 +1,27 @@
<template> <template>
<v-container class="home-container"> <v-container class="home-container">
<v-row justify="center" align="center" class="home-header"> <v-row justify="center" align="center" class="home-tabs">
<h1 class="home-title">PolyMarket</h1> <v-tabs v-model="activeTab" class="home-tab-bar">
</v-row> <v-tab value="overview">Market Overview</v-tab>
<v-tab value="trending">Trending</v-tab>
<v-row justify="center" align="center" class="home-subtitle"> <v-tab value="portfolio">Portfolio</v-tab>
<p>Welcome to PolyMarket - Your Gateway to Decentralized Trading</p> </v-tabs>
</v-row>
<v-row justify="center" align="center" class="home-content">
<v-col cols="12" md="8" lg="6">
<v-card class="home-card">
<v-card-title>Market Overview</v-card-title>
<v-card-text>
<p>Explore the latest market data and trading opportunities.</p>
<v-btn
class="home-btn"
color="primary"
@click="navigateToTrade"
>
Go to Trading
</v-btn>
</v-card-text>
</v-card>
</v-col>
</v-row> </v-row>
<div class="home-list">
<MarketCard v-for="value in 30" :key="value"></MarketCard>
</div>
</v-container> </v-container>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router' import { ref } from 'vue'
import MarketCard from '../components/MarketCard.vue'
const router = useRouter() const activeTab = ref('overview')
const navigateToTrade = () => {
// Navigate to trade page (we'll add this route later)
console.log('Navigate to trade page')
}
</script> </script>
<style scoped> <style scoped>
.home-container { .home-container {
padding: 40px 20px;
min-height: 100vh; min-height: 100vh;
} }
@ -56,6 +36,20 @@ const navigateToTrade = () => {
margin: 0; margin: 0;
} }
.home-list {
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 20px;
}
/* When only one column fits */
@media (max-width: 600px) {
.home-list > div {
flex: 1 1 100%;
}
}
.home-subtitle { .home-subtitle {
margin-bottom: 40px; margin-bottom: 40px;
} }
@ -66,10 +60,22 @@ const navigateToTrade = () => {
margin: 0; margin: 0;
} }
.home-content { .home-tabs {
margin-top: 40px; margin-top: 40px;
} }
.home-tab-bar {
position: fixed;
top: 64px; /* Adjust based on app bar height */
left: 0;
transform: none;
width: 100%;
z-index: 10;
background-color: white;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.home-card { .home-card {
border-radius: 12px; border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
@ -77,12 +83,6 @@ const navigateToTrade = () => {
text-align: center; text-align: center;
} }
.home-card-title {
font-size: 1.5rem;
font-weight: 500;
margin-bottom: 16px;
}
.home-card-text { .home-card-text {
margin-bottom: 24px; margin-bottom: 24px;
} }
@ -90,4 +90,20 @@ const navigateToTrade = () => {
.home-btn { .home-btn {
margin-top: 16px; margin-top: 16px;
} }
.market-card-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
padding: 20px 0;
width: 100%;
max-width: 100%;
}
/* Mobile view */
@media (max-width: 600px) {
.market-card-container {
grid-template-columns: 1fr;
}
}
</style> </style>