You should be able to import react-router and use a Link component with a to prop of “//messages/”. You can get the team name by passing it in from the redux store in your profile_popover/index.js file.
You can pass it in as a prop in your profile_popover/index.js. Something like this should work:
function mapDispatchToProps(state) {
return {
currentUserId: state.entities.users.currentUserId
};
}
To be honnest, I’m not a front end developer, either a backend one
I’m just an ops/devops, mattermost enthusiast, trying to override the profile popover.
I’ve already succeeded to create a server plugin in Go (my first dev in Go), but frontend … is not my cup of tea!
I think I understand the most part of your message, except how to get the team name.
Can you explain me a little more how can I get/import the redux store ? Is it the TeamStore like in the original popover ?
No problem! You have direct access to the redux store’s state in your index.js file (the connect() bit at the bottom will connect your component to redux). To get the team name, you can use a selector in your mapDispatchToProps function. Should look something like this:
const {connect} = window['react-redux'];
import {getCurrentTeam} from 'mattermost-redux-beta/selectors/entities/teams';
import ProfilePopover from './profile_popover.jsx';
function mapStateToProps(state) {
const team = getCurrentTeam(state) || {};
return {
currentUserId: state.entities.users.currentUserId,
teamName: team.name
};
}
export default connect(mapStateToProps)(ProfilePopover);
Then if you just add the prop in profile_popover.jsx you’ll have access to it