From cc8c0950aa8162f15e017c3afc9c405ec411b11a Mon Sep 17 00:00:00 2001
From: sopa301 <96387349+sopa301@users.noreply.github.com>
Date: Mon, 19 Feb 2024 12:22:15 +0800
Subject: [PATCH 1/7] Create component file
---
.../src/components/c-zoom-commit-message.vue | 190 ++++++++++++++++++
frontend/src/views/c-zoom.vue | 18 +-
2 files changed, 202 insertions(+), 6 deletions(-)
create mode 100644 frontend/src/components/c-zoom-commit-message.vue
diff --git a/frontend/src/components/c-zoom-commit-message.vue b/frontend/src/components/c-zoom-commit-message.vue
new file mode 100644
index 0000000000..140b9fb03e
--- /dev/null
+++ b/frontend/src/components/c-zoom-commit-message.vue
@@ -0,0 +1,190 @@
+
+//- use tabindex to enable focus property on div
+.commit-message(
+ tabindex="-1",
+ v-bind:key="slice.hash",
+ v-bind:class="{ 'message-body active': slice.messageBody !== '' }"
+)
+ span.code-merge-icon(v-if="slice.isMergeCommit")
+ font-awesome-icon(icon="code-merge")
+ span
+ a.message-title(v-bind:href="getSliceLink(slice)",
+ v-bind:class="!isBrokenLink(getSliceLink(slice)) ? '' : 'broken-link'", target="_blank")
+ .within-border {{ slice.messageTitle.substr(0, 50) }}
+ .not-within-border(v-if="slice.messageTitle.length > 50")
+ |{{ slice.messageTitle.substr(50) }}
+ span(data-cy="changes") (+{{ slice.insertions }} -{{ slice.deletions }} lines)
+ .hash
+ span {{ slice.hash.substr(0, 7) }}
+ span.fileTypeLabel(
+ v-if="containsAtLeastOneSelected(Object.keys(slice.fileTypesAndContributionMap))",
+ v-for="fileType in\
+ Object.keys(slice.fileTypesAndContributionMap)",
+ vbind:key="fileType",
+ v-bind:style="{\
+ 'background-color': fileTypeColors[fileType],\
+ 'color': getFontColor(fileTypeColors[fileType])\
+ }"
+ ) {{ fileType }}
+ template(v-if="slice.tags")
+ .tag(
+ v-for="tag in slice.tags",
+ vbind:key="tag",
+ tabindex="-1", v-bind:class="[`${slice.hash}`, tag]"
+ )
+ font-awesome-icon(icon="tags")
+ span {{ tag }}
+ a(
+ v-if="slice.messageBody !== ''",
+ v-on:click="toggleSelectedCommitMessageBody(slice)"
+ )
+ .tooltip(
+ v-on:mouseover="onTooltipHover(`${slice.hash}-show-hide-message-body`)",
+ v-on:mouseout="resetTooltip(`${slice.hash}-show-hide-message-body`)"
+ )
+ font-awesome-icon.commit-message--button(icon="ellipsis-h")
+ span.tooltip-text(
+ v-bind:ref="`${slice.hash}-show-hide-message-body`"
+ ) Click to show/hide the commit message body
+ .body(v-if="slice.messageBody !== ''", v-show="slice.isOpen")
+ pre {{ slice.messageBody }}
+ .dashed-border
+ template(
+ v-if="showDiffstat"
+ )
+ c-stacked-bar-chart(
+ v-bind:bars="getContributionBars(slice)"
+ )
+
+
+
+
diff --git a/frontend/src/views/c-zoom.vue b/frontend/src/views/c-zoom.vue
index 51494f0b92..f402fd4066 100644
--- a/frontend/src/views/c-zoom.vue
+++ b/frontend/src/views/c-zoom.vue
@@ -75,9 +75,9 @@
v-for="fileType in fileTypes",
v-bind:key="fileType",
v-bind:style="{\
- 'background-color': fileTypeColors[fileType],\
- 'color': getFontColor(fileTypeColors[fileType])\
- }"
+ 'background-color': fileTypeColors[fileType],\
+ 'color': getFontColor(fileTypeColors[fileType])\
+ }"
)
input.mui-checkbox--fileType(type="checkbox", v-bind:value="fileType",
v-on:change="updateSelectedFileTypesHash", v-model="selectedFileTypes")
@@ -86,6 +86,11 @@
.zoom__day(v-for="day in selectedCommits", v-bind:key="day.date")
h3(v-if="info.zTimeFrame === 'week'") Week of {{ day.date }}
h3(v-else) {{ day.date }}
+ .c-zoom-commit-message(v-for="slice in day.commitResults", tabindex="-1",
+ v-bind:key="slice.hash", v-bind:day="day", v-bind:slice="slice",
+ v-bind:selectedFileTypes="selectedFileTypes", v-bind:fileTypeColors="fileTypeColors",
+ v-bind:class="{ 'message-body active': slice.messageBody !== '' }")
+
//- use tabindex to enable focus property on div
.commit-message(
tabindex="-1",
@@ -153,6 +158,7 @@ import brokenLinkDisabler from '../mixin/brokenLinkMixin';
import tooltipPositioner from '../mixin/dynamicTooltipMixin';
import cRamp from '../components/c-ramp.vue';
import cStackedBarChart from '../components/c-stacked-bar-chart.vue';
+import cZoomCommitMessage from '../components/c-zoom-commit-message.vue';
import {
Bar,
Commit,
@@ -182,6 +188,7 @@ export default defineComponent({
FontAwesomeIcon,
cRamp,
cStackedBarChart,
+ cZoomCommitMessage,
},
mixins: [brokenLinkDisabler, tooltipPositioner],
data() {
@@ -444,8 +451,8 @@ export default defineComponent({
updateSelectedFileTypesHash() {
const fileTypeHash = this.selectedFileTypes.length > 0
- ? this.selectedFileTypes.reduce((a, b) => `${a}~${b}`)
- : '';
+ ? this.selectedFileTypes.reduce((a, b) => `${a}~${b}`)
+ : '';
window.addHash('zFT', fileTypeHash);
window.encodeHash();
@@ -657,5 +664,4 @@ export default defineComponent({
}
}
}
-
From d21d8f86c767bcebe877ed4f8cde2196ede1418e Mon Sep 17 00:00:00 2001
From: sopa301 <96387349+sopa301@users.noreply.github.com>
Date: Mon, 19 Feb 2024 13:23:05 +0800
Subject: [PATCH 2/7] Some stuff
---
.../src/components/c-zoom-commit-message.vue | 92 +++++++++++
frontend/src/views/c-zoom.vue | 149 +-----------------
2 files changed, 93 insertions(+), 148 deletions(-)
diff --git a/frontend/src/components/c-zoom-commit-message.vue b/frontend/src/components/c-zoom-commit-message.vue
index 140b9fb03e..599c57cc70 100644
--- a/frontend/src/components/c-zoom-commit-message.vue
+++ b/frontend/src/components/c-zoom-commit-message.vue
@@ -188,3 +188,95 @@ export default defineComponent({
},
});
+
+
diff --git a/frontend/src/views/c-zoom.vue b/frontend/src/views/c-zoom.vue
index f402fd4066..e5c4b05ab2 100644
--- a/frontend/src/views/c-zoom.vue
+++ b/frontend/src/views/c-zoom.vue
@@ -86,68 +86,10 @@
.zoom__day(v-for="day in selectedCommits", v-bind:key="day.date")
h3(v-if="info.zTimeFrame === 'week'") Week of {{ day.date }}
h3(v-else) {{ day.date }}
- .c-zoom-commit-message(v-for="slice in day.commitResults", tabindex="-1",
+ .c-zoom-commit-message(v-for="slice in day.commitResults",
v-bind:key="slice.hash", v-bind:day="day", v-bind:slice="slice",
v-bind:selectedFileTypes="selectedFileTypes", v-bind:fileTypeColors="fileTypeColors",
v-bind:class="{ 'message-body active': slice.messageBody !== '' }")
-
- //- use tabindex to enable focus property on div
- .commit-message(
- tabindex="-1",
- v-for="slice in day.commitResults",
- v-bind:key="slice.hash",
- v-bind:class="{ 'message-body active': slice.messageBody !== '' }"
- )
- span.code-merge-icon(v-if="slice.isMergeCommit")
- font-awesome-icon(icon="code-merge")
- span
- a.message-title(v-bind:href="getSliceLink(slice)",
- v-bind:class="!isBrokenLink(getSliceLink(slice)) ? '' : 'broken-link'", target="_blank")
- .within-border {{ slice.messageTitle.substr(0, 50) }}
- .not-within-border(v-if="slice.messageTitle.length > 50")
- |{{ slice.messageTitle.substr(50) }}
- span(data-cy="changes") (+{{ slice.insertions }} -{{ slice.deletions }} lines)
- .hash
- span {{ slice.hash.substr(0, 7) }}
- span.fileTypeLabel(
- v-if="containsAtLeastOneSelected(Object.keys(slice.fileTypesAndContributionMap))",
- v-for="fileType in\
- Object.keys(slice.fileTypesAndContributionMap)",
- vbind:key="fileType",
- v-bind:style="{\
- 'background-color': fileTypeColors[fileType],\
- 'color': getFontColor(fileTypeColors[fileType])\
- }"
- ) {{ fileType }}
- template(v-if="slice.tags")
- .tag(
- v-for="tag in slice.tags",
- vbind:key="tag",
- tabindex="-1", v-bind:class="[`${slice.hash}`, tag]"
- )
- font-awesome-icon(icon="tags")
- span {{ tag }}
- a(
- v-if="slice.messageBody !== ''",
- v-on:click="toggleSelectedCommitMessageBody(slice)"
- )
- .tooltip(
- v-on:mouseover="onTooltipHover(`${slice.hash}-show-hide-message-body`)",
- v-on:mouseout="resetTooltip(`${slice.hash}-show-hide-message-body`)"
- )
- font-awesome-icon.commit-message--button(icon="ellipsis-h")
- span.tooltip-text(
- v-bind:ref="`${slice.hash}-show-hide-message-body`"
- ) Click to show/hide the commit message body
- .body(v-if="slice.messageBody !== ''", v-show="slice.isOpen")
- pre {{ slice.messageBody }}
- .dashed-border
- template(
- v-if="showDiffstat"
- )
- c-stacked-bar-chart(
- v-bind:bars="getContributionBars(slice)"
- )