Skip to content

Add tooltip with absolute date and time on relative times #17431

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
Apr 28, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions components/dashboard/src/admin/ProjectsSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { AdminPageHeader } from "./AdminPageHeader";
import Pagination from "../Pagination/Pagination";
import { SpinnerLoader } from "../components/Loader";
import searchIcon from "../icons/search.svg";
import Tooltip from "../components/Tooltip";

export default function ProjectsSearchPage() {
return (
Expand Down Expand Up @@ -155,9 +156,11 @@ export function ProjectsSearch() {
<div className="text-gray-500 dark:text-gray-100 truncate">{p.project.cloneUrl}</div>
</div>
<div className="flex w-2/12 self-center">
<div className="text-sm w-full text-gray-400 truncate">
{dayjs(p.project.creationTime).fromNow()}
</div>
<Tooltip content={dayjs(p.project.creationTime).format("MMM D, YYYY")}>
<div className="text-sm w-full text-gray-400 truncate">
{dayjs(p.project.creationTime).fromNow()}
</div>
</Tooltip>
</div>
</div>
</Link>
Expand Down
7 changes: 6 additions & 1 deletion components/dashboard/src/admin/UserSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getGitpodService } from "../service/service";
import { AdminPageHeader } from "./AdminPageHeader";
import UserDetail from "./UserDetail";
import searchIcon from "../icons/search.svg";
import Tooltip from "../components/Tooltip";

export default function UserSearch() {
const location = useLocation();
Expand Down Expand Up @@ -144,7 +145,11 @@ function UserEntry(p: { user: User }) {
</div>
</div>
<div className="flex w-5/12 self-center">
<div className="text-sm w-full text-gray-400 truncate">{dayjs(p.user.creationDate).fromNow()}</div>
<Tooltip content={dayjs(p.user.creationDate).format("MMM D, YYYY")}>
<div className="text-sm w-full text-gray-400 truncate">
{dayjs(p.user.creationDate).fromNow()}
</div>
</Tooltip>
</div>
</div>
</Link>
Expand Down
11 changes: 8 additions & 3 deletions components/dashboard/src/admin/WorkspacesSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { isGitpodIo } from "../utils";
import { SpinnerLoader } from "../components/Loader";
import { WorkspaceStatusIndicator } from "../workspaces/WorkspaceStatusIndicator";
import searchIcon from "../icons/search.svg";
import Tooltip from "../components/Tooltip";

interface Props {
user?: User;
Expand Down Expand Up @@ -192,9 +193,13 @@ function WorkspaceEntry(p: { ws: WorkspaceAndInstance }) {
</div>
</div>
<div className="flex w-2/12 self-center">
<div className="text-sm w-full text-gray-400 truncate">
{dayjs(p.ws.instanceCreationTime || p.ws.workspaceCreationTime).fromNow()}
</div>
<Tooltip
content={dayjs(p.ws.instanceCreationTime || p.ws.workspaceCreationTime).format("MMM D, YYYY")}
>
<div className="text-sm w-full text-gray-400 truncate">
{dayjs(p.ws.instanceCreationTime || p.ws.workspaceCreationTime).fromNow()}
</div>
</Tooltip>
</div>
</div>
</Link>
Expand Down
5 changes: 4 additions & 1 deletion components/dashboard/src/projects/Prebuilds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { Disposable } from "vscode-jsonrpc";
import { useCurrentProject } from "./project-context";
import { getProjectTabs } from "./projects.routes";
import search from "../icons/search.svg";
import Tooltip from "../components/Tooltip";

export default function PrebuildsPage(props: { project?: Project; isAdminDashboard?: boolean }) {
const currentProject = useCurrentProject();
Expand Down Expand Up @@ -222,7 +223,9 @@ export default function PrebuildsPage(props: { project?: Project; isAdminDashboa
alt={p.info.startedBy}
/>
)}
Triggered {formatDate(p.info.startedAt)}
<Tooltip content={dayjs(p.info.startedAt).format("MMM D, YYYY")}>
Triggered {formatDate(p.info.startedAt)}
</Tooltip>
</p>
</div>
</ItemField>
Expand Down
20 changes: 16 additions & 4 deletions components/dashboard/src/projects/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useCurrentProject } from "./project-context";
import { getProjectTabs } from "./projects.routes";
import { shortCommitMessage, toRemoteURL } from "./render-utils";
import search from "../icons/search.svg";
import Tooltip from "../components/Tooltip";

export default function ProjectsPage() {
const history = useHistory();
Expand Down Expand Up @@ -334,10 +335,21 @@ export default function ProjectsPage() {
<div className="text-base text-gray-500 dark:text-gray-50 font-medium mb-1 truncate">
{shortCommitMessage(branch.changeTitle)}
</div>
<p>
{avatar}Authored {formatDate(branch.changeDate)} ·{" "}
{branch.changeHash?.substring(0, 8)}
</p>
{branch.changeDate ? (
<Tooltip
content={dayjs(branch.changeDate).format("MMM D, YYYY")}
>
<p>
{avatar}Authored {formatDate(branch.changeDate)} ·{" "}
{branch.changeHash?.substring(0, 8)}
</p>
</Tooltip>
) : (
<p>
{avatar}Authored {formatDate(branch.changeDate)} ·{" "}
{branch.changeHash?.substring(0, 8)}
</p>
)}
</div>
</ItemField>
<ItemField className="flex items-center my-auto">
Expand Down
9 changes: 6 additions & 3 deletions components/dashboard/src/projects/ProjectListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { gitpodHostUrl } from "../service/service";
import { useLatestProjectPrebuildQuery } from "../data/prebuilds/latest-project-prebuild-query";
import { StartWorkspaceModalContext } from "../workspaces/start-workspace-modal-context";
import { useNewCreateWorkspacePage } from "../workspaces/CreateWorkspacePage";
import Tooltip from "../components/Tooltip";

type ProjectListItemProps = {
project: Project;
Expand Down Expand Up @@ -102,9 +103,11 @@ export const ProjectListItem: FunctionComponent<ProjectListItemProps> = ({ proje
{prebuild?.info?.branch}
</div>
<span className="flex-shrink-0 mx-1 text-gray-400 dark:text-gray-600">·</span>
<div className="flex-shrink-0 text-gray-400 dark:text-gray-500 group-hover:text-gray-800 dark:group-hover:text-gray-300">
{dayjs(prebuild?.info?.startedAt).fromNow()}
</div>
<Tooltip content={dayjs(prebuild?.info?.startedAt).format("MMM D, YYYY")}>
<div className="flex-shrink-0 text-gray-400 dark:text-gray-500 group-hover:text-gray-800 dark:group-hover:text-gray-300">
{dayjs(prebuild?.info?.startedAt).fromNow()}
</div>
</Tooltip>
</Link>
<Link
to={`/projects/${Project.slug(project!)}/prebuilds`}
Expand Down
4 changes: 3 additions & 1 deletion components/dashboard/src/teams/Members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ export default function MembersPage() {
</div>
</ItemField>
<ItemField className="my-auto">
<span className="text-gray-400">{dayjs(m.memberSince).fromNow()}</span>
<Tooltip content={dayjs(m.memberSince).format("MMM D, YYYY")}>
<span className="text-gray-400">{dayjs(m.memberSince).fromNow()}</span>
</Tooltip>
</ItemField>
<ItemField className="flex items-center my-auto">
<span className="text-gray-400 capitalize">
Expand Down