Skip to content

Commit d524226

Browse files
committed
RPi Mounts redesigned
1 parent 3c7af00 commit d524226

5 files changed

Lines changed: 50 additions & 13 deletions

File tree

src/components/ModuleFace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const ModuleFace = ({
3535
{!hasImage && (
3636
<div className="flex flex-col items-center opacity-80 pointer-events-none w-full px-4">
3737
<span className="font-mono text-xs uppercase tracking-widest text-white/50 mb-1">
38-
{module.name.substring(0, 18)}
38+
{module.name.substring(0, 32)}
3939
</span>
4040

4141
{/* Visual Features based on Type */}

src/components/module-faces/AccessoryFace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const AccessoryFace = ({
2828
}
2929

3030
if (id === 'rpi-mount' || name.includes('raspberry') || name.includes('rpi')) {
31-
return <RPIMountFace />;
31+
return <RPIMountFace rackWidth={rackWidth} uSize={module.uSize} />;
3232
}
3333

3434
// Default to Vent if it seems like a vent, or if generic accessory
Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
1+
import { type RackWidth } from '../../../types';
2+
import { RPIMountSlot } from './RPIMountSlot';
3+
4+
export const RPIMountFace = ({
5+
rackWidth,
6+
uSize = 1,
7+
}: {
8+
rackWidth?: RackWidth;
9+
uSize?: number;
10+
}) => {
11+
const is10Inch = rackWidth === '10inch';
12+
const is2U = uSize === 2;
13+
14+
// Slot count logic
15+
let slotCount;
16+
if (is2U) {
17+
slotCount = is10Inch ? 4 : 10;
18+
} else {
19+
slotCount = is10Inch ? 2 : 4;
20+
}
121

2-
export const RPIMountFace = () => {
322
return (
4-
<div className="w-full h-full flex items-center justify-center gap-4">
5-
{Array.from({ length: 4 }).map((_, i) => (
6-
<div key={i} className="w-8 h-full bg-green-900/40 border border-green-800 mx-1 flex flex-col items-center justify-center relative">
7-
{/* Fake RPi PCB */}
8-
<div className="w-6 h-[80%] bg-emerald-700/80 border border-emerald-600 rounded-sm shadow-md"></div>
9-
<div className="absolute top-2 w-4 h-4 bg-gray-400 rounded-sm"></div> {/* USB/Ethernet */}
10-
</div>
11-
))}
23+
<div className="w-full h-full flex flex-col items-center justify-center py-2">
24+
<div className="flex gap-2 items-center justify-center w-full px-2">
25+
{Array.from({ length: slotCount }).map((_, i) => (
26+
<RPIMountSlot key={i} vertical={is2U} />
27+
))}
28+
</div>
1229
</div>
1330
);
1431
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const RPIMountSlot = ({ vertical = false }: { vertical?: boolean }) => {
2+
return (
3+
<div
4+
className={`${vertical
5+
? 'w-[70px] h-[130px] flex-col py-3'
6+
: 'w-[150px] h-[45px] flex-row px-3'
7+
} border-[1px] border-white/20 rounded-md bg-transparent flex items-center justify-between`}
8+
>
9+
<div className="w-2 h-2 rounded-full border border-white/20 bg-transparent" />
10+
<div className="w-2 h-2 rounded-full border border-white/20 bg-transparent" />
11+
</div>
12+
);
13+
};

src/data/modules.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ export const PREDEFINED_MODULES: RackModule[] = [
4949
{ id: 'shelf', name: 'Shelf', uSize: 1, type: 'accessory', color: 'bg-slate-800' },
5050
{
5151
id: 'rpi-mount',
52-
name: 'Raspberry Pi Mount',
52+
name: '1U Raspberry Pi Mount',
5353
uSize: 1,
5454
type: 'accessory',
55-
color: 'bg-emerald-900',
55+
color: 'bg-slate-900',
56+
},
57+
{
58+
id: 'rpi-mount-2u',
59+
name: '2U Raspberry Pi Mount',
60+
uSize: 2,
61+
type: 'accessory',
62+
color: 'bg-slate-900',
5663
},
5764
];

0 commit comments

Comments
 (0)