import React from 'react'; import { Box, Link, Typography, Avatar, Grid, SxProps, CardActions } from '@mui/material'; import { Card, CardContent, Divider, useTheme, } from '@mui/material'; import DeleteIcon from '@mui/icons-material/Delete'; import { useMediaQuery } from '@mui/material'; import { JobFull } from 'types/types'; import { CopyBubble } from "components/CopyBubble"; import { rest } from 'lodash'; import { AIBanner } from 'components/ui/AIBanner'; import { useAuth } from 'hooks/AuthContext'; import { DeleteConfirmation } from '../DeleteConfirmation'; interface JobInfoProps { job: JobFull; sx?: SxProps; action?: string; elevation?: number; variant?: "small" | "normal" | null }; const JobInfo: React.FC = (props: JobInfoProps) => { const { job } = props; const { user, apiClient } = useAuth(); const { sx, action = '', elevation = 1, variant = "normal" } = props; const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('md')); const isAdmin = user?.isAdmin; const deleteJob = async (jobId: string | undefined) => { if (jobId) { await apiClient.deleteJob(jobId); } } if (!job) { return No user loaded.; } console.log(job); return ( {variant !== "small" && <> {job.location && Location: {job.location.city}, {job.location.state || job.location.country} } {job.title && Title: {job.title} } {/* {job.datePosted && Posted: {job.datePosted.toISOString()} } */} {job.company && Company: {job.company} } {job.summary && Summary: {job.summary} } } {isAdmin && { deleteJob(job.id); }} sx={{ minWidth: 'auto', px: 2, maxHeight: "min-content", color: "red" }} action="delete" label="job" title="Delete job" icon= message={`Are you sure you want to delete ${job.id}? This action cannot be undone.`} />} ); }; export { JobInfo };