Skip to content

Commit aecb924

Browse files
committed
feat: use database logo as card bg on database page
1 parent dccd1e0 commit aecb924

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

src/pages/DatabasePage.tsx

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Typography, Button, Container } from "@mui/material";
1+
import { Box, Typography, Button, Container, Avatar } from "@mui/material";
22
import { Colors } from "design/theme";
33
import { useAppDispatch } from "hooks/useAppDispatch";
44
import { useAppSelector } from "hooks/useAppSelector";
@@ -12,6 +12,7 @@ const DatabasePage: React.FC = () => {
1212
const navigate = useNavigate();
1313
const dispatch = useAppDispatch();
1414
const { registry } = useAppSelector(NeurojsonSelector);
15+
console.log("registry", registry);
1516

1617
useEffect(() => {
1718
dispatch(fetchRegistry());
@@ -70,17 +71,23 @@ const DatabasePage: React.FC = () => {
7071
key={db.id}
7172
variant="outlined"
7273
sx={{
74+
position: "relative", // for overlay positioning
7375
padding: 3,
7476
textTransform: "none",
7577
fontWeight: 600,
7678
borderColor: Colors.lightGray,
79+
backgroundImage: db.logo ? `url(${db.logo})` : "none",
80+
backgroundSize: "cover",
81+
backgroundPosition: "center",
7782
color: Colors.lightGray,
7883
borderRadius: 2,
7984
transition: "all 0.3s ease",
80-
height: "100px",
85+
height: "150px",
8186
display: "flex",
82-
flexDirection: "column",
87+
flexDirection: "row",
8388
justifyContent: "center",
89+
overflow: "hidden", // clip overlay inside
90+
gap: 1,
8491
"&:hover": {
8592
borderColor: Colors.lightGray,
8693
backgroundColor: Colors.secondaryPurple,
@@ -90,9 +97,41 @@ const DatabasePage: React.FC = () => {
9097
}}
9198
onClick={() => navigate(`${RoutesEnum.DATABASES}/${db.id}`)}
9299
>
93-
<Typography variant="h6" component="span">
94-
{db.name || "Unnamed Database"}
95-
</Typography>
100+
{/* Overlay for fade/blur */}
101+
<Box
102+
sx={{
103+
position: "absolute",
104+
top: 0,
105+
left: 0,
106+
width: "100%",
107+
height: "100%",
108+
backgroundColor: "rgba(0,0,0,0.4)", // dark overlay
109+
backdropFilter: "blur(4px)",
110+
zIndex: 1,
111+
}}
112+
/>
113+
114+
{/* Text goes above overlay */}
115+
<Box sx={{ zIndex: 2, textAlign: "center" }}>
116+
<Typography
117+
variant="h6"
118+
component="span"
119+
sx={{
120+
color: "white",
121+
display: "-webkit-box",
122+
WebkitBoxOrient: "vertical",
123+
WebkitLineClamp: 2, // only show 2 lines
124+
overflow: "hidden",
125+
textOverflow: "ellipsis",
126+
}}
127+
title={db.fullname} // tooltip full name
128+
>
129+
{db.fullname || "Unnamed Database"}
130+
</Typography>
131+
<Typography
132+
sx={{ color: "white" }}
133+
>{`(${db.name})`}</Typography>
134+
</Box>
96135
</Button>
97136
);
98137
})}

0 commit comments

Comments
 (0)