Skip to content

Commit a740210

Browse files
committed
chore: removed see more see less view in info card
1 parent 65e2cb9 commit a740210

File tree

1 file changed

+4
-83
lines changed

1 file changed

+4
-83
lines changed

src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx

Lines changed: 4 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
/* eslint-disable eqeqeq */
18-
import { useState } from 'react'
1918
import moment from 'moment'
2019
import Tippy from '@tippyjs/react'
2120
import ClipboardButton from '@Common/ClipboardButton/ClipboardButton'
@@ -48,8 +47,6 @@ const GitCommitInfoGeneric = ({
4847
index,
4948
isExcluded = false,
5049
}: GitCommitInfoGenericProps) => {
51-
const [showSeeMore, setShowSeeMore] = useState(true)
52-
5350
const lowerCaseCommitInfo = getLowerCaseObject(commitInfo)
5451
const _isWebhook =
5552
materialSourceType === SourceTypeMap.WEBHOOK ||
@@ -111,80 +108,6 @@ const GitCommitInfoGeneric = ({
111108
)
112109
}
113110

114-
function renderMoreDataForWebhook(_moreData) {
115-
return !showSeeMore ? (
116-
<div className="material-history__all-changes">
117-
<div className="material-history__body mt-4">
118-
{Object.keys(_moreData).map((_key, idx) => {
119-
let classes
120-
if (idx % 2 == 0) {
121-
classes = 'bcn-1'
122-
}
123-
return (
124-
<div
125-
key={_key}
126-
className={`material-history__text material-history__grid left pt-4 pb-4 ${classes}`}
127-
>
128-
<div>{_key}</div>
129-
<div>{_moreData[_key]}</div>
130-
</div>
131-
)
132-
})}
133-
</div>
134-
</div>
135-
) : null
136-
}
137-
138-
function renderSeeMoreButtonForWebhook() {
139-
return (
140-
<button
141-
type="button"
142-
className="fs-12 fw-6 pt-12 mt-12 pl-12 pr-12 w-100 bcn-0 flex left br-4 dc__box-shadow-top cb-5 dc__no-border"
143-
onClick={(event) => {
144-
event.stopPropagation()
145-
setShowSeeMore(!showSeeMore)
146-
}}
147-
>
148-
{showSeeMore ? 'See More' : 'See Less'}
149-
</button>
150-
)
151-
}
152-
153-
function handleMoreDataForWebhook() {
154-
const _moreData = {}
155-
if (_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED) {
156-
Object.keys(_webhookData.data).forEach((_key) => {
157-
if (
158-
_key != 'author' &&
159-
_key != 'date' &&
160-
_key != 'git url' &&
161-
_key != 'source branch name' &&
162-
_key != 'source checkout' &&
163-
_key != 'target branch name' &&
164-
_key != 'target checkout' &&
165-
_key != 'title'
166-
) {
167-
_moreData[_key] = _webhookData.data[_key]
168-
}
169-
})
170-
} else if (_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED) {
171-
Object.keys(_webhookData.data).forEach((_key) => {
172-
if (_key !== 'author' && _key !== 'date' && _key !== 'target checkout') {
173-
_moreData[_key] = _webhookData.data[_key]
174-
}
175-
})
176-
}
177-
178-
const _hasMoreData = Object.keys(_moreData).length > 0
179-
180-
return (
181-
<>
182-
{_hasMoreData && renderMoreDataForWebhook(_moreData)}
183-
{_hasMoreData && renderSeeMoreButtonForWebhook()}
184-
</>
185-
)
186-
}
187-
188111
const matSelectionText = (): JSX.Element => {
189112
if (isExcluded) {
190113
return (
@@ -220,7 +143,7 @@ const GitCommitInfoGeneric = ({
220143
_webhookData.data.title ? <span className="flex left cn-9 fw-6 fs-13">{_webhookData.data.title}</span> : null
221144

222145
const renderPullRequestId = (pullRequestUrl: string) => {
223-
const pullRequestId = pullRequestUrl.split('/').pop()
146+
const pullRequestId = pullRequestUrl?.split('/').pop()
224147

225148
return (
226149
<div className="w-100 flex left dc__gap-4">
@@ -240,10 +163,10 @@ const GitCommitInfoGeneric = ({
240163
)
241164
}
242165

243-
const renderTagCreationId = () => (
166+
const renderTagCreationId = (tagRequestUrl: string) => (
244167
<div className="commit-hash px-6 dc__w-fit-content dc__gap-4 fs-13">
245168
<Tag className="icon-dim-14 scb-5" />
246-
{_webhookData.data['target checkout']}
169+
{tagRequestUrl}
247170
</div>
248171
)
249172

@@ -267,7 +190,6 @@ const GitCommitInfoGeneric = ({
267190
</div>
268191
{renderWebhookTitle()}
269192
{renderBasicGitCommitInfoForWebhook(true)}
270-
{handleMoreDataForWebhook()}
271193
</div>
272194
)
273195

@@ -276,11 +198,10 @@ const GitCommitInfoGeneric = ({
276198
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED && (
277199
<>
278200
<div className="flex left dc__content-space">
279-
{renderTagCreationId()}
201+
{renderTagCreationId(_webhookData.data['target checkout'])}
280202
{getCheckUncheckIcon()}
281203
</div>
282204
{renderBasicGitCommitInfoForWebhook()}
283-
{handleMoreDataForWebhook()}
284205
</>
285206
)
286207

0 commit comments

Comments
 (0)