Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3a28f7a
migrate team sidebar component to typescript
Raghunandhan8818 Mar 3, 2024
7b3775b
added tests to the team_sidebar components
Raghunandhan8818 Mar 9, 2024
9d0099e
fixed lint issues
Raghunandhan8818 Mar 9, 2024
d7dacd5
moved rtl to devdependencies, added snapshot tests to team_sidebar
Raghunandhan8818 Mar 12, 2024
8c95b3b
removed mocking in team_sidebar.test, added @reduxjs/toolkit in devde…
Raghunandhan8818 Mar 14, 2024
1ae80bd
gitlabURL and username added in the team_sidebar.test
Raghunandhan8818 Mar 23, 2024
bb5571c
changed gitlabURL in team_sidebar.test and updated the snapshots
Raghunandhan8818 Mar 28, 2024
e4c1763
downgrade @redux/toolkit and excluded 'node_modules'from type-checkin…
Raghunandhan8818 May 7, 2024
f051d2e
Fix. conflicts in package.json
Raghunandhan8818 Dec 12, 2024
eaaebb2
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
Kshitij-Katiyar Jan 31, 2025
95f6058
fixed missing dependency
Kshitij-Katiyar Jan 31, 2025
a8938c3
added missing redux offline package
Kshitij-Katiyar Feb 4, 2025
de1b4e6
Merge branch 'master' into 435-team-sidebar-ts-migration
mattermost-build Feb 5, 2025
d3ebdea
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
Kshitij-Katiyar Feb 25, 2025
5ed5f2e
fixed lint issues
Kshitij-Katiyar Feb 25, 2025
d0d4463
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
Kshitij-Katiyar Feb 26, 2025
3b0d8d9
updated jest version
Kshitij-Katiyar Feb 26, 2025
b0200c8
Empty commit
Kshitij-Katiyar Feb 28, 2025
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
31,014 changes: 18,438 additions & 12,576 deletions webapp/package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
"reselect": "4.1.6"
},
"devDependencies": {
"babel-jest": "29.5.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.7",
"enzyme-to-json": "3.6.2",
"identity-obj-proxy": "3.0.0",
"@babel/cli": "7.11.6",
"@babel/core": "7.11.6",
"@babel/eslint-parser": "7.22.15",
Expand All @@ -49,6 +44,8 @@
"@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4",
"@babel/runtime": "7.11.2",
"@reduxjs/toolkit": "2.2.1",
"@testing-library/react": "12.1.2",
"@types/react": "16.9.49",
"@types/react-bootstrap": "0.32.29",
"@types/react-custom-scrollbars": "4.0.10",
Expand All @@ -57,6 +54,7 @@
"@types/react-transition-group": "4.4.0",
"@typescript-eslint/eslint-plugin": "4.1.1",
"@typescript-eslint/parser": "4.1.1",
"babel-jest": "29.5.0",
"babel-loader": "8.1.0",
"babel-plugin-typescript-to-proptypes": "1.4.1",
"css-loader": "4.3.0",
Expand All @@ -67,6 +65,7 @@
"eslint-plugin-react": "7.20.6",
"eslint-plugin-react-hooks": "4.1.2",
"file-loader": "6.1.0",
"identity-obj-proxy": "3.0.0",
"style-loader": "1.2.1",
"typescript": "4.6.4",
"webpack": "4.44.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`TeamSidebar should render when show is false 1`] = `<div />`;

exports[`TeamSidebar should render when show is true 1`] = `
<div>
<div>
<a
href="https://gitlab.com"
rel="noopener noreferrer"
style="color: rgba(51, 51, 51, 0.6); display: block; margin-bottom: 10px; width: 100%;"
target="_blank"
>
<i
class="fa fa-gitlab fa-lg"
/>
</a>
<a
style="color: rgba(51, 51, 51, 0.6); display: block; margin-bottom: 10px; width: 100%;"
>
<svg
height="13"
viewBox="0 0 16 16"
width="13"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M10.34 1.22a.75.75 0 0 0-1.06 0L7.53 2.97 7 3.5l.53.53 1.75 1.75a.75.75 0 1 0 1.06-1.06l-.47-.47h.63c.69 0 1.25.56 1.25 1.25v4.614a2.501 2.501 0 1 0 1.5 0V5.5a2.75 2.75 0 0 0-2.75-2.75h-.63l.47-.47a.75.75 0 0 0 0-1.06ZM13.5 12.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-9 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm1.5 0a2.5 2.5 0 1 1-3.25-2.386V5.886a2.501 2.501 0 1 1 1.5 0v4.228A2.501 2.501 0 0 1 6 12.5Zm-1.5-9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
fill="rgba(51,51,51,0.6)"
fill-rule="evenodd"
/>
</svg>
<span
style="margin-left: 2px;"
>
0
</span>
</a>
<a
style="color: rgba(51, 51, 51, 0.6); display: block; margin-bottom: 10px; width: 100%;"
>
<svg
height="13"
viewBox="0 0 16 16"
width="13"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M9 2.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm1.45-.5a2.5 2.5 0 0 0-4.9 0H3a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1h-2.55ZM8 5H5.5V3.5h-2v11h9v-11h-2V5H8ZM5 7.75A.75.75 0 0 1 5.75 7h4.5a.75.75 0 0 1 0 1.5h-4.5A.75.75 0 0 1 5 7.75Zm.75 1.75a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"
fill="rgba(51,51,51,0.6)"
fill-rule="evenodd"
/>
</svg>
<span
style="margin-left: 2px;"
>
0
</span>
</a>
<a
style="color: rgba(51, 51, 51, 0.6); display: block; margin-bottom: 10px; width: 100%;"
>
<svg
height="13"
viewBox="0 0 16 16"
width="13"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M3 2.5h6a.5.5 0 0 1 .5.5v10a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V3a.5.5 0 0 1 .5-.5ZM1 3a2 2 0 0 1 2-2h6a2 2 0 0 1 1.97 1.658l2.913 1.516a1.75 1.75 0 0 1 .744 2.36l-3.878 7.45a.753.753 0 0 1-.098.145c-.36.526-.965.871-1.651.871H3a2 2 0 0 1-2-2V3Zm10 7.254 2.297-4.413a.25.25 0 0 0-.106-.337L11 4.364v5.89Z"
fill="rgba(51,51,51,0.6)"
fill-rule="evenodd"
/>
</svg>
<span
style="margin-left: 2px;"
>
0
</span>
</a>
<a
style="color: rgba(51, 51, 51, 0.6); display: block; margin-bottom: 10px; width: 100%;"
>
<svg
height="13"
viewBox="0 0 16 16"
width="13"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M3 13.5a.5.5 0 0 1-.5-.5V3a.5.5 0 0 1 .5-.5h9.25a.75.75 0 0 0 0-1.5H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9.75a.75.75 0 0 0-1.5 0V13a.5.5 0 0 1-.5.5H3Zm12.78-8.82a.75.75 0 0 0-1.06-1.06L9.162 9.177 7.289 7.241a.75.75 0 1 0-1.078 1.043l2.403 2.484a.75.75 0 0 0 1.07.01L15.78 4.68Z"
fill="rgba(51,51,51,0.6)"
fill-rule="evenodd"
/>
</svg>
<span
style="margin-left: 2px;"
>
0
</span>
</a>
<a
href="#"
style="color: rgba(51, 51, 51, 0.6); display: block; margin-bottom: 10px; width: 100%;"
>
<i
class="fa fa-refresh fa-spin"
/>
</a>
</div>
</div>
`;
2 changes: 1 addition & 1 deletion webapp/src/components/team_sidebar/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {connect} from 'react-redux';

import TeamSidebar from './team_sidebar.jsx';
import TeamSidebar from './team_sidebar';

function mapStateToProps(state) {
const members = state.entities.teams.myMembers || {};
Expand Down
24 changes: 0 additions & 24 deletions webapp/src/components/team_sidebar/team_sidebar.jsx

This file was deleted.

77 changes: 77 additions & 0 deletions webapp/src/components/team_sidebar/team_sidebar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from 'react';

import {describe, expect, test} from '@jest/globals';
import {render} from '@testing-library/react';
import {configureStore, createSlice} from '@reduxjs/toolkit';

import {Provider} from 'react-redux';

import TeamSidebar from './team_sidebar';

const mockTheme = {
sidebarBg: '#ffffff',
sidebarText: '#333333',
sidebarUnreadText: '#ff0000',
sidebarTextHoverBg: '#eeeeee',
sidebarTextActiveBorder: '#007bff',
sidebarTextActiveColor: '#007bff',
sidebarHeaderBg: '#f8f9fa',
sidebarHeaderTextColor: '#495057',
onlineIndicator: '#28a745',
awayIndicator: '#ffc107',
dndIndicator: '#dc3545',
mentionBg: '#ffeb3b',
mentionBj: '#ffeb3b',
mentionColor: '#333333',
centerChannelBg: '#f8f9fa',
centerChannelColor: '#333333',
newMessageSeparator: '#007bff',
linkColor: '#007bff',
buttonBg: '#007bff',
buttonColor: '#ffffff',
errorTextColor: '#dc3545',
mentionHighlightBg: '#ffeb3b',
mentionHighlightLink: '#007bff',
codeTheme: 'solarized-dark',
};

const mockSlice = createSlice({
name: 'mock-reducer',
initialState: {
'plugins-com.github.manland.mattermost-plugin-gitlab': {
connected: true,
username: '',
clientId: '',
lhsData: {
reviews: [],
yourAssignedPrs: [],
yourAssignedIssues: [],
todos: [],
},
gitlabURL: '',
organization: '',
rhsPluginAction: () => true,
Comment on lines 42 to 56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why clientId is here exposed to the client. That's a bit concerning 😅 At least there's not a clientSecret which would be detrimental

If we are setting connected: true, then I think we should also set username and gitlabURL, since those will always be present when connected is true. No worries if it doesn't change the snapshot I suppose

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mickmister , I have set values to the gitlabURL and username and updated the snapshots.

Kindly take a look at it.

},
entities: {general: {config: {}}},
},
reducers: {},
});

const mockStore = configureStore({
reducer: mockSlice.reducer,
});

describe('TeamSidebar', () => {
test.each([true, false])('should render when show is %s', (show) => {
const {container} = render(
<Provider store={mockStore}>
<TeamSidebar
show={show}
theme={mockTheme}
/>
</Provider>,
);

expect(container).toMatchSnapshot();
});
});
25 changes: 25 additions & 0 deletions webapp/src/components/team_sidebar/team_sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, {FC} from 'react';

import {Theme} from 'mattermost-redux/types/preferences';

import SidebarButtons from '../sidebar_buttons';

interface TeamSidebarProps {
show: boolean;
theme: Theme;
}

const TeamSidebar: FC<TeamSidebarProps> = ({show, theme}: TeamSidebarProps) => {
if (!show) {
return null;
}

return (
<SidebarButtons
theme={theme}
isTeamSidebar={true}
/>
);
};

export default TeamSidebar;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: There should be a newline at the end of this file