merged vault (from main) and resolved conflicts

This commit is contained in:
Shekar Siri 2022-05-18 12:04:07 +02:00
parent 336046a443
commit 9ea1992b34
5 changed files with 62 additions and 18 deletions

View file

@ -11,7 +11,7 @@ import { useModal } from 'App/components/Modal';
import SessionSettings from 'Shared/SessionSettings/SessionSettings'
function SessionsMenu(props) {
const { activeTab } = props;
const { activeTab, keyMap, wdTypeCount, toggleRehydratePanel, isEnterprise } = props;
const { showModal } = useModal();
const onMenuItemClick = (filter) => {
@ -76,8 +76,8 @@ function SessionsMenu(props) {
<div className={stl.divider} />
<div className="my-3">
<SideMenuitem
title="Bookmarks"
iconName="star"
title={ isEnterprise ? "Vault" : "Bookmarks" }
iconName={ isEnterprise ? "safe" : "star" }
active={activeTab.type === 'bookmark'}
onClick={() => onMenuItemClick({ name: 'Bookmarks', type: 'bookmark' })}
/>
@ -96,6 +96,7 @@ export default connect(state => ({
captureRate: state.getIn(['watchdogs', 'captureRate']),
filters: state.getIn([ 'filters', 'appliedFilter' ]),
sessionsLoading: state.getIn([ 'sessions', 'fetchLiveListRequest', 'loading' ]),
isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee',
}), {
clearEvents, fetchSessionList
})(SessionsMenu);

View file

@ -12,6 +12,7 @@ import SharePopup from '../shared/SharePopup/SharePopup';
import { fetchList as fetchListIntegration } from 'Duck/integrations/actions';
import { countries } from 'App/constants';
import SessionMetaList from 'Shared/SessionItem/SessionMetaList';
import Bookmark from 'Shared/Bookmark'
import stl from './playerBlockHeader.css';
import Issues from './Issues/Issues';
@ -162,7 +163,8 @@ export default class PlayerBlockHeader extends React.PureComponent {
<>
<Autoplay />
<div className={ stl.divider } />
<IconButton
<Bookmark sessionId={sessionId} favorite={favorite} />
{/* <IconButton
// className="mr-2"
tooltip="Bookmark"
tooltipPosition="top right"
@ -170,7 +172,7 @@ export default class PlayerBlockHeader extends React.PureComponent {
loading={ loading }
icon={ favorite ? 'star-solid' : 'star' }
plain
/>
/> */}
<div className={ stl.divider } />
<SharePopup
entity="sessions"

View file

@ -1,26 +1,59 @@
import React, { useState } from 'react'
//@ts-nocheck
import React, { useEffect, useState } from 'react'
import stl from './bookmark.css'
import { Icon } from 'UI'
import { toggleFavorite } from 'Duck/sessions'
import { connect } from 'react-redux'
// import Session from 'Types/session';
import { toast } from 'react-toastify';
import { Tooltip } from 'react-tippy';
interface Props {
toggleFavorite: (session) => void,
toggleFavorite: (sessionId: string) => Promise<void>,
favorite: Boolean,
sessionId: any
sessionId: any,
isEnterprise: Boolean
}
function Bookmark({ toggleFavorite, sessionId, favorite } : Props ) {
function Bookmark(props : Props ) {
const { sessionId, favorite, isEnterprise } = props;
const [isFavorite, setIsFavorite] = useState(favorite);
const ADDED_MESSAGE = isEnterprise ? 'Session added to vault' : 'Session added to your favorites';
const REMOVED_MESSAGE = isEnterprise ? 'Session removed from vault' : 'Session removed from your favorites';
const TOOLTIP_TEXT_ADD = isEnterprise ? 'Add to vault' : 'Add to favorites';
const TOOLTIP_TEXT_REMOVE = isEnterprise ? 'Remove from vault' : 'Remove from favorites';
return (
<div
className={ stl.favoriteWrapper }
onClick={ () => toggleFavorite(sessionId) }
data-favourite={ favorite }
const ACTIVE_ICON = isEnterprise ? 'safe-fill' : 'star-solid';
const INACTIVE_ICON = isEnterprise ? 'safe' : 'star';
useEffect(() => {
setIsFavorite(favorite);
}, [favorite]);
const toggleFavorite = async () => {
props.toggleFavorite(sessionId).then(() => {
toast.success(isFavorite ? REMOVED_MESSAGE : ADDED_MESSAGE);
setIsFavorite(!isFavorite);
});
}
return (
<Tooltip
delay={500}
arrow
title={isFavorite ? TOOLTIP_TEXT_REMOVE : TOOLTIP_TEXT_ADD}
hideOnClick={true}
>
<Icon name={ favorite ? 'star-solid' : 'star' } size="20" />
</div>
<div
className={ stl.favoriteWrapper }
onClick={ toggleFavorite }
data-favourite={ isFavorite }
>
<Icon name={ isFavorite ? ACTIVE_ICON : INACTIVE_ICON } color="teal" size="20" />
</div>
</Tooltip>
)
}
export default connect(null, { toggleFavorite })(Bookmark)
export default connect(state => ({
isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee',
}), { toggleFavorite })(Bookmark)

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" class="bi bi-safe-fill" viewBox="0 0 16 16">
<path d="M9.778 9.414A2 2 0 1 1 6.95 6.586a2 2 0 0 1 2.828 2.828z"/>
<path d="M2.5 0A1.5 1.5 0 0 0 1 1.5V3H.5a.5.5 0 0 0 0 1H1v3.5H.5a.5.5 0 0 0 0 1H1V12H.5a.5.5 0 0 0 0 1H1v1.5A1.5 1.5 0 0 0 2.5 16h12a1.5 1.5 0 0 0 1.5-1.5v-13A1.5 1.5 0 0 0 14.5 0h-12zm3.036 4.464 1.09 1.09a3.003 3.003 0 0 1 3.476 0l1.09-1.09a.5.5 0 1 1 .707.708l-1.09 1.09c.74 1.037.74 2.44 0 3.476l1.09 1.09a.5.5 0 1 1-.707.708l-1.09-1.09a3.002 3.002 0 0 1-3.476 0l-1.09 1.09a.5.5 0 1 1-.708-.708l1.09-1.09a3.003 3.003 0 0 1 0-3.476l-1.09-1.09a.5.5 0 1 1 .708-.708zM14 6.5v3a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 1 0z"/>
</svg>

After

Width:  |  Height:  |  Size: 678 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" class="bi bi-safe" viewBox="0 0 16 16">
<path d="M1 1.5A1.5 1.5 0 0 1 2.5 0h12A1.5 1.5 0 0 1 16 1.5v13a1.5 1.5 0 0 1-1.5 1.5h-12A1.5 1.5 0 0 1 1 14.5V13H.5a.5.5 0 0 1 0-1H1V8.5H.5a.5.5 0 0 1 0-1H1V4H.5a.5.5 0 0 1 0-1H1V1.5zM2.5 1a.5.5 0 0 0-.5.5v13a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5v-13a.5.5 0 0 0-.5-.5h-12z"/>
<path d="M13.5 6a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 .5-.5zM4.828 4.464a.5.5 0 0 1 .708 0l1.09 1.09a3.003 3.003 0 0 1 3.476 0l1.09-1.09a.5.5 0 1 1 .707.708l-1.09 1.09c.74 1.037.74 2.44 0 3.476l1.09 1.09a.5.5 0 1 1-.707.708l-1.09-1.09a3.002 3.002 0 0 1-3.476 0l-1.09 1.09a.5.5 0 1 1-.708-.708l1.09-1.09a3.003 3.003 0 0 1 0-3.476l-1.09-1.09a.5.5 0 0 1 0-.708zM6.95 6.586a2 2 0 1 0 2.828 2.828A2 2 0 0 0 6.95 6.586z"/>
</svg>

After

Width:  |  Height:  |  Size: 791 B