Spaces:
Sleeping
Sleeping
pranav8tripathi@gmail.com commited on
Commit ·
cebf62c
1
Parent(s): 3937b35
UI changes
Browse files- src/components/LandingPage.tsx +125 -60
src/components/LandingPage.tsx
CHANGED
|
@@ -1,6 +1,19 @@
|
|
| 1 |
import React from 'react';
|
| 2 |
-
import {
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
type AgentCardProps = {
|
| 6 |
agent: Agent;
|
|
@@ -10,54 +23,88 @@ type AgentCardProps = {
|
|
| 10 |
const AgentCard: React.FC<AgentCardProps> = ({ agent, onSelect }) => {
|
| 11 |
const theme = useTheme();
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
return (
|
| 14 |
<Card
|
| 15 |
sx={{
|
| 16 |
-
|
|
|
|
| 17 |
m: 2,
|
| 18 |
-
|
| 19 |
-
'&:hover': {
|
| 20 |
-
transform: 'translateY(-4px)',
|
| 21 |
-
boxShadow: theme.shadows[8],
|
| 22 |
-
},
|
| 23 |
-
opacity: agent.upcoming ? 0.7 : 1,
|
| 24 |
}}
|
| 25 |
-
onClick={() => !
|
| 26 |
>
|
| 27 |
-
<CardActionArea disabled={
|
| 28 |
-
<CardContent
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
/>
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
<Box
|
| 43 |
component="span"
|
| 44 |
sx={{
|
| 45 |
-
backgroundColor: theme.palette.
|
| 46 |
-
color: theme.palette.
|
| 47 |
-
fontSize: '0.
|
| 48 |
px: 1,
|
| 49 |
-
py: 0.
|
| 50 |
-
borderRadius:
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
verticalAlign: 'middle'
|
| 54 |
}}
|
| 55 |
>
|
| 56 |
-
|
| 57 |
</Box>
|
| 58 |
)}
|
| 59 |
-
</
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
{agent.description}
|
| 62 |
</Typography>
|
| 63 |
</CardContent>
|
|
@@ -72,40 +119,58 @@ type LandingPageProps = {
|
|
| 72 |
};
|
| 73 |
|
| 74 |
const LandingPage: React.FC<LandingPageProps> = ({ agents, onAgentSelect }) => {
|
|
|
|
|
|
|
| 75 |
return (
|
| 76 |
<Box
|
| 77 |
sx={{
|
|
|
|
|
|
|
| 78 |
display: 'flex',
|
| 79 |
flexDirection: 'column',
|
| 80 |
-
minHeight: '100vh',
|
| 81 |
alignItems: 'center',
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
| 85 |
}}
|
| 86 |
>
|
| 87 |
-
<
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
<
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
</Box>
|
| 108 |
);
|
| 109 |
};
|
| 110 |
|
| 111 |
-
export default LandingPage;
|
|
|
|
| 1 |
import React from 'react';
|
| 2 |
+
import {
|
| 3 |
+
Box,
|
| 4 |
+
Card,
|
| 5 |
+
CardContent,
|
| 6 |
+
Typography,
|
| 7 |
+
CardActionArea,
|
| 8 |
+
useTheme,
|
| 9 |
+
Grid,
|
| 10 |
+
Container,
|
| 11 |
+
Stack
|
| 12 |
+
} from '@mui/material';
|
| 13 |
+
import { Agent } from '../contexts/AgentContext'; // Assuming this import is correct
|
| 14 |
+
|
| 15 |
+
// Helper constants for beautiful design
|
| 16 |
+
const CARD_WIDTH = 280;
|
| 17 |
|
| 18 |
type AgentCardProps = {
|
| 19 |
agent: Agent;
|
|
|
|
| 23 |
const AgentCard: React.FC<AgentCardProps> = ({ agent, onSelect }) => {
|
| 24 |
const theme = useTheme();
|
| 25 |
|
| 26 |
+
const isDisabled = agent.upcoming;
|
| 27 |
+
|
| 28 |
+
// Determine colors based on status
|
| 29 |
+
const cardSx = isDisabled ? {
|
| 30 |
+
opacity: 0.6,
|
| 31 |
+
cursor: 'not-allowed',
|
| 32 |
+
bgcolor: theme.palette.action.disabledBackground,
|
| 33 |
+
} : {
|
| 34 |
+
cursor: 'pointer',
|
| 35 |
+
bgcolor: theme.palette.background.paper,
|
| 36 |
+
boxShadow: theme.shadows[4],
|
| 37 |
+
transition: 'transform 0.3s, box-shadow 0.3s',
|
| 38 |
+
'&:hover': {
|
| 39 |
+
transform: 'translateY(-6px)',
|
| 40 |
+
boxShadow: theme.shadows[12], // Deeper shadow on hover
|
| 41 |
+
borderColor: theme.palette.primary.main,
|
| 42 |
+
},
|
| 43 |
+
border: `1px solid ${theme.palette.divider}`,
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
return (
|
| 47 |
<Card
|
| 48 |
sx={{
|
| 49 |
+
width: CARD_WIDTH,
|
| 50 |
+
borderRadius: 3, // Slightly more rounded edges
|
| 51 |
m: 2,
|
| 52 |
+
...cardSx,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
}}
|
| 54 |
+
onClick={() => !isDisabled && onSelect(agent)}
|
| 55 |
>
|
| 56 |
+
<CardActionArea disabled={isDisabled} sx={{ height: '100%' }}>
|
| 57 |
+
<CardContent
|
| 58 |
+
sx={{
|
| 59 |
+
textAlign: 'center',
|
| 60 |
+
py: 4,
|
| 61 |
+
display: 'flex',
|
| 62 |
+
flexDirection: 'column',
|
| 63 |
+
alignItems: 'center',
|
| 64 |
+
height: '100%',
|
| 65 |
+
}}
|
| 66 |
+
>
|
| 67 |
+
{/* Agent Logo/Image */}
|
| 68 |
+
<Box
|
| 69 |
+
component="img"
|
| 70 |
+
src={agent.avatar}
|
| 71 |
+
alt={agent.name}
|
| 72 |
+
sx={{
|
| 73 |
+
width: 120,
|
| 74 |
+
height: 120,
|
| 75 |
+
mb: 3,
|
| 76 |
+
objectFit: 'contain',
|
| 77 |
+
maxWidth:'100 px' ,
|
| 78 |
+
bgcolor: 'transparent',
|
| 79 |
+
}}
|
| 80 |
/>
|
| 81 |
+
|
| 82 |
+
{/* Agent Name and Status */}
|
| 83 |
+
<Stack direction="row" alignItems="center" justifyContent="center" spacing={1} mb={1}>
|
| 84 |
+
<Typography variant="h6" component="div" sx={{ fontWeight: 600 }}>
|
| 85 |
+
{agent.name}
|
| 86 |
+
</Typography>
|
| 87 |
+
{isDisabled && (
|
| 88 |
<Box
|
| 89 |
component="span"
|
| 90 |
sx={{
|
| 91 |
+
backgroundColor: theme.palette.primary.main, // Premium badge color
|
| 92 |
+
color: theme.palette.primary.contrastText,
|
| 93 |
+
fontSize: '0.75rem',
|
| 94 |
px: 1,
|
| 95 |
+
py: 0.2,
|
| 96 |
+
borderRadius: 99, // Pill shape
|
| 97 |
+
fontWeight: 600,
|
| 98 |
+
textTransform: 'uppercase'
|
|
|
|
| 99 |
}}
|
| 100 |
>
|
| 101 |
+
Upcoming
|
| 102 |
</Box>
|
| 103 |
)}
|
| 104 |
+
</Stack>
|
| 105 |
+
|
| 106 |
+
{/* Description */}
|
| 107 |
+
<Typography variant="body2" color="text.secondary" sx={{ minHeight: '40px' }}>
|
| 108 |
{agent.description}
|
| 109 |
</Typography>
|
| 110 |
</CardContent>
|
|
|
|
| 119 |
};
|
| 120 |
|
| 121 |
const LandingPage: React.FC<LandingPageProps> = ({ agents, onAgentSelect }) => {
|
| 122 |
+
const theme = useTheme();
|
| 123 |
+
|
| 124 |
return (
|
| 125 |
<Box
|
| 126 |
sx={{
|
| 127 |
+
minHeight: '100vh',
|
| 128 |
+
width: '100%',
|
| 129 |
display: 'flex',
|
| 130 |
flexDirection: 'column',
|
|
|
|
| 131 |
alignItems: 'center',
|
| 132 |
+
pt: 8, // Padding top for header
|
| 133 |
+
pb: 8,
|
| 134 |
+
// Use a slight gradient or subtle background pattern for depth
|
| 135 |
+
bgcolor: theme.palette.mode === 'dark' ? '#121212' : '#f5f7fa',
|
| 136 |
}}
|
| 137 |
>
|
| 138 |
+
<Container maxWidth="lg">
|
| 139 |
+
{/* Header/Hero Section */}
|
| 140 |
+
<Box sx={{ textAlign: 'center', mb: 6, mt: 4 }}>
|
| 141 |
+
<Typography
|
| 142 |
+
variant="h3"
|
| 143 |
+
component="h1"
|
| 144 |
+
gutterBottom
|
| 145 |
+
sx={{ fontWeight: 700, color: theme.palette.text.primary }}
|
| 146 |
+
>
|
| 147 |
+
Choose Your AI Assistant
|
| 148 |
+
</Typography>
|
| 149 |
+
<Typography variant="h6" color="text.secondary" maxWidth="md" mx="auto">
|
| 150 |
+
Explore specialized AI agents designed to tackle specific legal research and analysis challenges.
|
| 151 |
+
</Typography>
|
| 152 |
+
</Box>
|
| 153 |
+
|
| 154 |
+
{/* Agent Cards Grid */}
|
| 155 |
+
<Grid
|
| 156 |
+
container
|
| 157 |
+
spacing={4}
|
| 158 |
+
justifyContent="center"
|
| 159 |
+
>
|
| 160 |
+
{agents.map((agent) => (
|
| 161 |
+
<Grid item key={agent.id} xs={12} sm={6} md={4} lg={3}
|
| 162 |
+
sx={{ display: 'flex', justifyContent: 'center' }}
|
| 163 |
+
>
|
| 164 |
+
<AgentCard
|
| 165 |
+
agent={agent}
|
| 166 |
+
onSelect={onAgentSelect}
|
| 167 |
+
/>
|
| 168 |
+
</Grid>
|
| 169 |
+
))}
|
| 170 |
+
</Grid>
|
| 171 |
+
</Container>
|
| 172 |
</Box>
|
| 173 |
);
|
| 174 |
};
|
| 175 |
|
| 176 |
+
export default LandingPage;
|