Skip to content

fix: remove connected button #13625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions site/src/pages/WorkspacePage/WorkspaceScheduleControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import type { Template, Workspace } from "api/typesGenerated";
import { TopbarData, TopbarIcon } from "components/FullPageLayout/Topbar";
import { displayError, displaySuccess } from "components/GlobalSnackbar/utils";
import { Pill } from "components/Pill/Pill";
import { useTime } from "hooks/useTime";
import { getWorkspaceActivityStatus } from "modules/workspaces/activity";
import {
Expand Down Expand Up @@ -170,11 +169,9 @@ const AutostopDisplay: FC<AutostopDisplayProps> = ({

const [showControlsAnyway, setShowControlsAnyway] = useState(false);
let onClickScheduleIcon: (() => void) | undefined;
let activity: ReactNode = null;

if (activityStatus === "connected") {
onClickScheduleIcon = () => setShowControlsAnyway((it) => !it);
activity = <Pill type="active">Connected</Pill>;

const now = dayjs();
const noRequiredStopSoon =
Expand All @@ -183,12 +180,7 @@ const AutostopDisplay: FC<AutostopDisplayProps> = ({

// User has shown controls manually, or we should warn about a nearby required stop
if (!showControlsAnyway && noRequiredStopSoon) {
return (
<>
{activity}
<WorkspaceScheduleContainer onClickIcon={onClickScheduleIcon} />
</>
);
return <WorkspaceScheduleContainer onClickIcon={onClickScheduleIcon} />;
}
}

Expand Down Expand Up @@ -239,24 +231,18 @@ const AutostopDisplay: FC<AutostopDisplayProps> = ({

if (tooltip) {
return (
<>
{activity}
<WorkspaceScheduleContainer onClickIcon={onClickScheduleIcon}>
<Tooltip title={tooltip}>{display}</Tooltip>
{controls}
</WorkspaceScheduleContainer>
</>
<WorkspaceScheduleContainer onClickIcon={onClickScheduleIcon}>
<Tooltip title={tooltip}>{display}</Tooltip>
{controls}
</WorkspaceScheduleContainer>
);
}

return (
<>
{activity}
<WorkspaceScheduleContainer onClickIcon={onClickScheduleIcon}>
{display}
{controls}
</WorkspaceScheduleContainer>
</>
<WorkspaceScheduleContainer onClickIcon={onClickScheduleIcon}>
{display}
{controls}
</WorkspaceScheduleContainer>
);
};

Expand Down
Loading