Skip to content

Commit

Permalink
Merge pull request #1008 from tensorlakeai/chore/changes
Browse files Browse the repository at this point in the history
feat: cleanup and remove other namespaces support except default
  • Loading branch information
adithyaakrishna authored Nov 7, 2024
2 parents c88dc6f + 266161f commit c7dc53b
Show file tree
Hide file tree
Showing 26 changed files with 890 additions and 1,305 deletions.
40 changes: 24 additions & 16 deletions server/ui/src/components/CopyText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,41 @@ import { Box, IconButton, Tooltip } from "@mui/material";
import ContentCopy from "@mui/icons-material/ContentCopy";
import { useState } from "react";

const CopyText = ({
text,
color,
className,
tooltipTitle = "Copy to clipboard",
copiedTooltipTitle = "Copied!"
}: {
interface CopyTextProps {
text: string;
color?: string;
className?: string;
tooltipTitle?: string;
copiedTooltipTitle?: string;
}) => {
const [showAlert, setShowAlert] = useState(false);
const handleCopy = () => {
navigator.clipboard.writeText(text);
setShowAlert(true);
}

export function CopyText({
text,
className,
tooltipTitle = "Copy to clipboard",
copiedTooltipTitle = "Copied!"
}: CopyTextProps) {
const [isCopied, setIsCopied] = useState(false);

const handleCopy = async () => {
try {
await navigator.clipboard.writeText(text);
setIsCopied(true);
setTimeout(() => setIsCopied(false), 2000);
} catch (error) {
console.error('Failed to copy text:', error);
}
};

return (
<Box className={className}>
<Tooltip title={showAlert ? copiedTooltipTitle : tooltipTitle}>
<IconButton onClick={handleCopy}>
<ContentCopy sx={{ height: "20px" }} />
<Tooltip title={isCopied ? copiedTooltipTitle : tooltipTitle}>
<IconButton onClick={handleCopy} size="small">
<ContentCopy sx={{ height: 20 }} />
</IconButton>
</Tooltip>
</Box>
);
};
}

export default CopyText;
15 changes: 8 additions & 7 deletions server/ui/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { Box, Typography } from "@mui/material";
import Link from "@mui/material/Link";

const Footer = () => {
export function Footer() {
const currentYear = new Date().getFullYear();

return (
<Box py={2} textAlign={"center"}>
<Box py={2} textAlign="center">
<Typography variant="caption" color="CaptionText" align="center">
{"Copyright © "}
Copyright ©
<Link color="inherit" href="https://tensorlake.ai/">
Tensorlake
</Link>{" "}
{new Date().getFullYear()}
{"."}
</Link>
{` ${currentYear}.`}
</Typography>
</Box>
);
};
}

export default Footer;
9 changes: 4 additions & 5 deletions server/ui/src/components/InfoBox.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { Box, Typography } from '@mui/material';
import AccessTimeIcon from '@mui/icons-material/AccessTime';

interface InfoBoxProps {
text?: string;
}

const InfoBox: React.FC<InfoBoxProps> = ({text}) => {
export function InfoBox({ text }: InfoBoxProps) {
return (
<Box
sx={{
Expand All @@ -18,7 +17,7 @@ const InfoBox: React.FC<InfoBoxProps> = ({text}) => {
justifyContent: 'center',
maxWidth: '500px',
margin: '10px',
boxShadow: "0px 1px 2px 0px #00000040 inset",
boxShadow: '0px 1px 2px 0px #00000040 inset',
}}
>
<AccessTimeIcon
Expand All @@ -34,6 +33,6 @@ const InfoBox: React.FC<InfoBoxProps> = ({text}) => {
</Typography>
</Box>
);
};
}

export default InfoBox;
export default InfoBox;
75 changes: 0 additions & 75 deletions server/ui/src/components/NamespaceSelector.tsx

This file was deleted.

12 changes: 8 additions & 4 deletions server/ui/src/components/TruncatedText.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { Tooltip, Typography } from '@mui/material';

const TruncatedText = ({ text, maxLength = 25 }: { text: string, maxLength: number}) => {
interface TruncatedTextProps {
text: string;
maxLength?: number;
}

export function TruncatedText({ text, maxLength = 25 }: TruncatedTextProps) {
const truncatedText = text.length > maxLength
? `${text.slice(0, maxLength)}...`
: text;

return (
<Tooltip content={text} title={text}>
<Tooltip title={text}>
<Typography
variant="h6"
component="div"
Expand All @@ -17,6 +21,6 @@ const TruncatedText = ({ text, maxLength = 25 }: { text: string, maxLength: numb
</Typography>
</Tooltip>
);
};
}

export default TruncatedText;
export default TruncatedText;
Loading

0 comments on commit c7dc53b

Please sign in to comment.