diff --git a/package.json b/package.json index cb3fcf3..6d31b16 100644 --- a/package.json +++ b/package.json @@ -12731,7 +12731,7 @@ "vscode:prepublish": "yarn run bundle" }, "dependencies": { - "@gitkraken/gitkraken-components": "2.0.0", + "@gitkraken/gitkraken-components": "2.1.0", "@microsoft/fast-element": "1.11.0", "@microsoft/fast-react-wrapper": "0.3.16-0", "@octokit/core": "4.1.0", diff --git a/src/plus/webviews/graph/protocol.ts b/src/plus/webviews/graph/protocol.ts index 98d138a..9bd1d9a 100644 --- a/src/plus/webviews/graph/protocol.ts +++ b/src/plus/webviews/graph/protocol.ts @@ -1,4 +1,5 @@ import type { + CommitDateTimeSource, CssVariables, ExcludeByType, ExcludeRefsById, @@ -49,6 +50,12 @@ export enum GraphRefMetadataTypes { export const supportedRefMetadataTypes: GraphRefMetadataType[] = Object.values(GraphRefMetadataTypes); +export type GraphCommitDateTimeSource = CommitDateTimeSource; +export enum GraphCommitDateTimeSources { + RowEntry = 'rowEntry', + Tooltip = 'tooltip', +} + export interface State { windowFocused?: boolean; repositories?: GraphRepository[]; diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 7eb0ebd..16f660b 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -25,6 +25,7 @@ import type { GraphAvatars, GraphColumnName, GraphColumnsConfig, + GraphCommitDateTimeSource, GraphComponentConfig, GraphExcludedRef, GraphExcludeTypes, @@ -49,6 +50,7 @@ import { DidChangeWorkingTreeNotificationType, DidFetchNotificationType, DidSearchNotificationType, + GraphCommitDateTimeSources, } from '../../../../plus/webviews/graph/protocol'; import type { Subscription } from '../../../../subscription'; import { getSubscriptionTimeRemaining, SubscriptionState } from '../../../../subscription'; @@ -89,7 +91,8 @@ export interface GraphWrapperProps { } const getGraphDateFormatter = (config?: GraphComponentConfig): OnFormatCommitDateTime => { - return (commitDateTime: number) => formatCommitDateTime(commitDateTime, config?.dateStyle, config?.dateFormat); + return (commitDateTime: number, source?: GraphCommitDateTimeSource) => + formatCommitDateTime(commitDateTime, config?.dateStyle, config?.dateFormat, source); }; const createIconElements = (): { [key: string]: ReactElement } => { @@ -1071,8 +1074,15 @@ function formatCommitDateTime( commitDateTime: number, style: DateStyle = DateStyle.Absolute, format: DateTimeFormat | string = 'short+short', + source?: GraphCommitDateTimeSource, ): string { - return style === DateStyle.Relative ? fromNow(commitDateTime) : formatDate(commitDateTime, format); + switch (source) { + case GraphCommitDateTimeSources.Tooltip: + return formatDate(commitDateTime, format); + case GraphCommitDateTimeSources.RowEntry: + default: + return style === DateStyle.Relative ? fromNow(commitDateTime) : formatDate(commitDateTime, format); + } } function getClosestSearchResultIndex( diff --git a/src/webviews/apps/settings/partials/commit-graph.html b/src/webviews/apps/settings/partials/commit-graph.html index 87b4afb..3d584ad 100644 --- a/src/webviews/apps/settings/partials/commit-graph.html +++ b/src/webviews/apps/settings/partials/commit-graph.html @@ -183,7 +183,8 @@ > diff --git a/yarn.lock b/yarn.lock index d00c14a..19c05e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -295,10 +295,10 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== -"@gitkraken/gitkraken-components@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@gitkraken/gitkraken-components/-/gitkraken-components-2.0.0.tgz#1a1cbb2ef3873a412b693381ea56869a018e697c" - integrity sha512-3caeyF2imEIwZSCwDAf8f5bsxzVZ+0kmL1lZww3CANFlDnhgK8LRU3QkdnuW/PICwZYEpOJop3/0myVBwE3Ieg== +"@gitkraken/gitkraken-components@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@gitkraken/gitkraken-components/-/gitkraken-components-2.1.0.tgz#5252db16363bd6d7f40a480c8515f3e5ca24802c" + integrity sha512-zyyJaMTaUiMUgJOIq6pQHQVAy9f1d2pspEc4p1aY+xlsO4R7o+RywGAEP20xHvkLaHkwJyKsDTbKh7xGSshDyA== dependencies: "@axosoft/react-virtualized" "9.22.3-gitkraken.3" classnames "^2.3.2"