feat: added debug button to actions panel

pull/3281/head
yougotwill 3 months ago
parent e1aaa52786
commit 794d20072c

@ -24,6 +24,7 @@ export type SessionIconType =
| 'copy'
| 'crown'
| 'communities'
| 'debug'
| 'delete'
| 'deleteModerator'
| 'ellipses'
@ -197,6 +198,11 @@ export const icons: Record<SessionIconType, IconProps> = {
viewBox: '4 4 7 7',
ratio: 1,
},
debug: {
path: 'M7.07 1.4C7.07.64 7.71 0 8.5 0c.95 0 1.63.88 1.38 1.78-.09.33-.04.7.14 1 .4.66 1.09 1.06 1.98 1.07.88 0 1.57-.4 1.98-1.08.18-.3.23-.66.14-1C13.87.89 14.55 0 15.49 0c.8 0 1.44.63 1.44 1.4 0 .68-.49 1.24-1.12 1.38-.32.07-.6.27-.77.55-.61 1.02.2 1.92.93 2.82A9.29 9.29 0 0 1 12 7a9.2 9.2 0 0 1-3.98-.84c.75-.92 1.56-1.8.94-2.83a1.2 1.2 0 0 0-.77-.55 1.42 1.42 0 0 1-1.12-1.37zM19.28 16.6c-.1.64.27 1.16.76 1.38l2.42 1.08c.54.23.77.85.53 1.37-.24.53-.87.75-1.4.52l-2.56-1.14c-.34-.15-.7-.06-.96.36A8.14 8.14 0 0 1 12 24c-3-.33-5.1-2.15-6.14-3.94-.2-.35-.56-.41-.9-.26L2.4 20.94c-.53.23-1.15 0-1.4-.52-.23-.52 0-1.14.53-1.37l2.42-1.08c.53-.23.87-.74.75-1.46-.1-.69-.69-1.06-1.26-1.06H1.05c-.58 0-1.05-.46-1.05-1.04s.47-1.03 1.05-1.03h2.4c.56 0 1.14-.36 1.24-1.11a1.2 1.2 0 0 0-.77-1.28l-2.23-.86c-.54-.21-.81-.82-.6-1.35.22-.53.83-.8 1.37-.58.23.09 2.33.94 2.57.94.24 0 .5-.12.67-.49.18-.4.38-.79.6-1.15C8 8.5 9.89 9 12 9c2.08 0 3.99-.51 5.7-1.5.22.37.43.76.62 1.19.14.31.4.45.65.45.39 0 2.46-1.02 2.96-1.02.41 0 .81.25.97.66.22.53-.05 1.14-.59 1.35l-2.23.86a1.2 1.2 0 0 0-.77 1.34c.1.65.66 1.05 1.23 1.05h2.4c.59 0 1.06.46 1.06 1.03s-.47 1.04-1.06 1.04h-2.38c-.56 0-1.15.33-1.28 1.14zM11 21.76v-10.8c-1.36-.1-2.65-.37-3.87-.84C5.88 12.88 5.85 20.17 11 21.76zm5.86-11.65c-1.23.48-2.52.75-3.86.85v10.8c5.1-1.57 5.15-8.72 3.86-11.65z',
viewBox: '0 0 24 24',
ratio: 1,
},
delete: {
path: 'M6.23797 20.7936h8.68143c1.6826 0 2.4218-.8316 2.6818-2.5046l1.3221-13.01158-1.584.06851-1.3154 12.85017c-.1183.7593-.5016 1.0643-1.1798 1.0643H6.31989c-.69165 0-1.06821-.305-1.17973-1.0643L3.82474 5.34593l-1.58407-.06851L3.5628 18.289c.25327 1.6797.9992 2.5046 2.67517 2.5046ZM2.33255 6.13273H18.8329c1.1101 0 1.7491-.71044 1.7491-1.81233V3.12482c0-1.10041-.639-1.81086-1.7491-1.81086H2.33255c-1.06689 0-1.750519.71045-1.750519 1.81086V4.3204c0 1.10189.641929 1.81233 1.750519 1.81233Zm.3146-1.45817c-.37493 0-.53844-.17021-.53844-.54661v-.81068c0-.37639.16351-.54661.53844-.54661H18.5236c.3749 0 .5317.17022.5317.54661v.81068c0 .3764-.1568.54661-.5317.54661H2.64715Z',
viewBox: '0 0 21 21',

@ -24,7 +24,11 @@ import { DecryptedAttachmentsManager } from '../../session/crypto/DecryptedAttac
import { DURATION } from '../../session/constants';
import { uploadOurAvatar } from '../../interactions/conversationInteractions';
import { editProfileModal, onionPathModal } from '../../state/ducks/modalDialog';
import {
editProfileModal,
onionPathModal,
updateDebugMenuModal,
} from '../../state/ducks/modalDialog';
import { loadDefaultRooms } from '../../session/apis/open_group_api/opengroupV2/ApiUtil';
import { getOpenGroupManager } from '../../session/apis/open_group_api/opengroupV2/OpenGroupManagerV2';
@ -78,6 +82,9 @@ const Section = (props: { type: SectionType }) => {
} else if (type === SectionType.PathIndicator) {
// Show Path Indicator Modal
dispatch(onionPathModal({}));
} else if (type === SectionType.DebugMenu) {
// Show Debug Menu
dispatch(updateDebugMenuModal({}));
} else {
// message section
dispatch(clearSearch());
@ -135,6 +142,16 @@ const Section = (props: { type: SectionType }) => {
ref={settingsIconRef}
/>
);
case SectionType.DebugMenu:
return (
<SessionIconButton
iconSize="medium"
dataTestId="debug-menu-section"
iconType={'debug'}
onClick={handleClick}
isSelected={isSelected}
/>
);
case SectionType.PathIndicator:
return (
<ActionPanelOnionStatusLight
@ -242,6 +259,7 @@ function useUpdateBadgeCount() {
export const ActionsPanel = () => {
const [startCleanUpMedia, setStartCleanUpMedia] = useState(false);
const ourPrimaryConversation = useSelector(getOurPrimaryConversation);
const showDebugMenu = window?.sessionFeatureFlags?.debug?.debugLogging;
// this maxi useEffect is called only once: when the component is mounted.
// For the action panel, it means this is called only one per app start/with a user logged in
@ -310,6 +328,7 @@ export const ActionsPanel = () => {
<Section type={SectionType.Profile} />
<Section type={SectionType.Message} />
<Section type={SectionType.Settings} />
{showDebugMenu && <Section type={SectionType.DebugMenu} />}
<Section type={SectionType.PathIndicator} />
<Section type={SectionType.ColorMode} />
</LeftPaneSectionContainer>

1
ts/react.d.ts vendored

@ -86,6 +86,7 @@ declare module 'react' {
| 'settings-section'
| 'message-section'
| 'privacy-section'
| 'debug-menu-section'
// settings menu item types
| 'message-requests-settings-menu-item'

@ -16,6 +16,7 @@ export enum SectionType {
Settings,
ColorMode,
PathIndicator,
DebugMenu,
}
type FocusSectionActionType = {

Loading…
Cancel
Save