Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: use emotion for styling (pt. 5) #10261

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 37 commits into from
Oct 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8ef2a58
emotion: `RuntimeErrorState`
aslilac Oct 13, 2023
c455b38
emotion: `FileUpload`
aslilac Oct 13, 2023
4e033c6
🧹
aslilac Oct 13, 2023
8d7e9a8
emotion: `FullPageForm`
aslilac Oct 13, 2023
eeb1b93
emotion: `EnterpriseSnackbar`
aslilac Oct 13, 2023
04adebe
emotion: `GlobalSnackbar`
aslilac Oct 13, 2023
2b49f62
emotion: `FullWidthPageHeader`
aslilac Oct 13, 2023
57b1f68
emotion: `PageButton`
aslilac Oct 13, 2023
715282c
emotion: `PaginationWidgetBase`
aslilac Oct 13, 2023
8927e23
emotion: `Paywall`
aslilac Oct 13, 2023
1857b71
emotion: `AgentLatency`
aslilac Oct 13, 2023
5bacdda
emotion: `AgentOutdatedTooltip`
aslilac Oct 13, 2023
9924a32
emotion: `PortForwardButton`
aslilac Oct 13, 2023
d49898c
emotion: `Section`
aslilac Oct 13, 2023
f4373dd
emotion: `AppLink`
aslilac Oct 13, 2023
351e310
🧹
aslilac Oct 13, 2023
196c7a8
emotion: `SensitiveValue`
aslilac Oct 13, 2023
3d14e1b
emotion: `BuildRow`
aslilac Oct 13, 2023
58daeaf
emotion: `ResetPasswordDialog`
aslilac Oct 13, 2023
8a5e35f
emotion: `UsersTableBody`
aslilac Oct 13, 2023
c8a94a5
emotion: `Workspace`
aslilac Oct 13, 2023
7058b7f
emotion: `UpdateBuildParametersDialog`
aslilac Oct 13, 2023
0972a1c
emotion: `SignInLayout`
aslilac Oct 13, 2023
2481674
emotion: `SSHButton`
aslilac Oct 13, 2023
f09e627
emotion: `TableLoader`
aslilac Oct 13, 2023
7135de3
emotion: `Welcome`
aslilac Oct 13, 2023
193c364
emotion: `TimelineDateRow`
aslilac Oct 13, 2023
007e048
emotion: `SSHKeysPageView`
aslilac Oct 13, 2023
10f041c
emotion: `WorkspaceSettingsLayout`
aslilac Oct 13, 2023
ec8cc6e
emotion: `TemplateLayout`
aslilac Oct 13, 2023
da1a641
emotion: `EmptyTemplates`
aslilac Oct 13, 2023
69fd068
emotion: `TemplateVariablesPageView`
aslilac Oct 13, 2023
fcc868b
Merge branch 'main' into emotional-damage-5
aslilac Oct 16, 2023
4b92f61
Revert "emotion: `AgentOutdatedTooltip`"
aslilac Oct 16, 2023
c2abccb
Revert "emotion: `PortForwardButton`"
aslilac Oct 16, 2023
9f73611
Revert "emotion: `Section`"
aslilac Oct 16, 2023
e3986d2
Revert "emotion: `AppLink`"
aslilac Oct 16, 2023
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
Prev Previous commit
Revert "emotion: AppLink"
This reverts commit f4373dd.
  • Loading branch information
aslilac committed Oct 16, 2023
commit e3986d2672beed23a1b13875d104ec4bb0462b5c
61 changes: 35 additions & 26 deletions site/src/components/Resources/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import CircularProgress from "@mui/material/CircularProgress";
import Link from "@mui/material/Link";
import { makeStyles } from "@mui/styles";
import Tooltip from "@mui/material/Tooltip";
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
import { type FC, useState } from "react";
import { useTheme } from "@emotion/react";
import { getApiKey } from "api/api";
import type * as TypesGen from "api/typesGenerated";
import { useProxy } from "contexts/ProxyContext";
import { PrimaryAgentButton } from "components/Resources/AgentButton";
import { createAppLinkHref } from "utils/apps";
import { FC, useState } from "react";
import { combineClasses } from "utils/combineClasses";
import * as TypesGen from "api/typesGenerated";
import { generateRandomString } from "utils/random";
import { BaseIcon } from "./BaseIcon";
import { ShareIcon } from "./ShareIcon";
import { useProxy } from "contexts/ProxyContext";
import { createAppLinkHref } from "utils/apps";
import { getApiKey } from "api/api";

const Language = {
appTitle: (appName: string, identifier: string): string =>
Expand All @@ -30,7 +31,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
const appsHost = proxy.preferredWildcardHostname;
const [fetchingSessionToken, setFetchingSessionToken] = useState(false);

const theme = useTheme();
const styles = useStyles();
const username = workspace.owner_name;

let appSlug = app.slug;
Expand Down Expand Up @@ -64,18 +65,12 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
}
if (app.health === "unhealthy") {
canClick = false;
icon = <ErrorOutlineIcon css={{ color: theme.palette.warning.light }} />;
icon = <ErrorOutlineIcon className={styles.unhealthyIcon} />;
primaryTooltip = "Unhealthy";
}
if (!appsHost && app.subdomain) {
canClick = false;
icon = (
<ErrorOutlineIcon
css={{
color: theme.palette.grey[300],
}}
/>
);
icon = <ErrorOutlineIcon className={styles.notConfiguredIcon} />;
primaryTooltip =
"Your admin has not configured subdomain application access";
}
Expand All @@ -91,13 +86,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
endIcon={isPrivateApp ? undefined : <ShareIcon app={app} />}
disabled={!canClick}
>
<span
css={
!isPrivateApp && {
marginRight: theme.spacing(1),
}
}
>
<span className={combineClasses({ [styles.appName]: !isPrivateApp })}>
{appDisplayName}
</span>
</PrimaryAgentButton>
Expand All @@ -109,10 +98,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
<Link
href={href}
target="_blank"
css={{
pointerEvents: canClick ? "none" : undefined,
textDecoration: "none !important",
}}
className={canClick ? styles.link : styles.disabledLink}
onClick={
canClick
? async (event) => {
Expand Down Expand Up @@ -157,3 +143,26 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
</Tooltip>
);
};

const useStyles = makeStyles((theme) => ({
link: {
textDecoration: "none !important",
},

disabledLink: {
pointerEvents: "none",
textDecoration: "none !important",
},

unhealthyIcon: {
color: theme.palette.warning.light,
},

notConfiguredIcon: {
color: theme.palette.grey[300],
},

appName: {
marginRight: theme.spacing(1),
},
}));