Path: blob/main/components/dashboard/src/dedicated-setup/SetupLayout.tsx
2506 views
/**1* Copyright (c) 2023 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { FC, useEffect } from "react";7import gitpodIcon from "../icons/gitpod.svg";8import { OrgIcon } from "../components/org-icon/OrgIcon";9import { useCurrentOrg } from "../data/organizations/orgs-query";10import check from "../images/check.svg";11import "./styles.css";1213type Props = {14showOrg?: boolean;15noMaxWidth?: boolean;16progressCurrent?: number;17progressTotal?: number;18};19export const SetupLayout: FC<Props> = ({20showOrg = false,21noMaxWidth = false,22progressCurrent,23progressTotal,24children,25}) => {26const currentOrg = useCurrentOrg();2728useEffect(() => {29document.body.classList.add("honeycomb-bg");3031return () => {32document.body.classList.remove("honeycomb-bg");33};34}, []);3536return (37<div className="container">38<div className="app-container">39<div className="flex justify-between items-center">40<div className="flex items-center justify-start py-3 space-x-1">41<img src={gitpodIcon} className="w-6 h-6" alt="Gitpod's logo" />42{showOrg ? (43<div className="pr-1 flex font-semibold whitespace-nowrap max-w-xs overflow-hidden">44<OrgIcon45id={currentOrg?.data?.id || "empty"}46name={currentOrg.data?.name || ""}47size="small"48className="mr-2"49/>50{currentOrg.data?.name}51</div>52) : (53<span className="text-lg">Gitpod</span>54)}55</div>56</div>57<div className={`mt-24 ${noMaxWidth ? "" : "max-w-md"} pb-4`}>58{/* generate the rounded dots for the progress */}59{progressCurrent !== undefined && progressTotal !== undefined ? (60<div className="flex flex-row space-x-2 mb-4">61{[...Array(progressTotal).keys()].map((i) => (62<ProgressElement key={i} i={i + 1} current={progressCurrent} />63))}64</div>65) : null}66<>{children}</>67</div>68</div>69</div>70);71};7273const ProgressElement: FC<{ i: number; current: number }> = ({ current, i }) => {74if (i < current) {75return (76<div className="w-5 h-5 bg-green-600 rounded-full flex justify-center items-center text-color-white">77<img src={check} width={15} height={15} alt="checkmark" />78</div>79);80} else if (i === current) {81return <div className="w-5 h-5 rounded-full bg-gray-400" />;82} else {83return <div className="w-5 h-5 rounded-full border-2 border-dashed border-gray-400" />;84}85};868788