Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Don't merge] Feature/polling #522

Draft
wants to merge 183 commits into
base: preprod
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
271027d
wip code
SupriyaAdep Jul 29, 2024
de2f06d
add poll form states and reducer
SupriyaAdep Jul 29, 2024
980a88b
rename files
SupriyaAdep Jul 29, 2024
c01b799
fix form data
SupriyaAdep Jul 29, 2024
1b6643a
rename types and improve state update
SupriyaAdep Jul 29, 2024
802ed38
add poll form
SupriyaAdep Jul 30, 2024
9b4fb60
fix imports
SupriyaAdep Jul 30, 2024
d37cb1b
wip poll event code
SupriyaAdep Aug 5, 2024
8181650
add poll event rtm layer
SupriyaAdep Aug 6, 2024
e95a094
fix directory structure
SupriyaAdep Aug 6, 2024
f483ac4
add poll rtm changes
SupriyaAdep Aug 7, 2024
6aeb481
redo the code
SupriyaAdep Aug 7, 2024
4d0b496
add poll timer
SupriyaAdep Aug 8, 2024
f1fc666
add timer
SupriyaAdep Aug 8, 2024
4f7f58d
improve variable names
SupriyaAdep Aug 8, 2024
fa9a5d9
improve variable names
SupriyaAdep Aug 8, 2024
878ff82
add response mcq
SupriyaAdep Aug 9, 2024
2ec4054
add percentage
SupriyaAdep Aug 9, 2024
0dae3af
add poll percentage
SupriyaAdep Aug 12, 2024
8148de9
remove code readability
SupriyaAdep Aug 12, 2024
983fb00
Added customization api to inject side panel
HariharanIT Aug 12, 2024
cf7eb97
rename radio button
SupriyaAdep Aug 12, 2024
d7dae4d
Updated action sheet to add custom one using customization
HariharanIT Aug 12, 2024
1a3f6eb
poll side abr
SupriyaAdep Aug 12, 2024
5a3f455
rename currentstep var
SupriyaAdep Aug 13, 2024
de2cd5a
fix modals maxwidth
SupriyaAdep Aug 13, 2024
5849acd
add close icon on modals
SupriyaAdep Aug 13, 2024
16c892a
Merge remote-tracking branch 'origin/custom-side-panel' into feature/…
SupriyaAdep Aug 13, 2024
acd0192
Updated the more menu to inject custom items
HariharanIT Aug 13, 2024
ef6db26
delete polling folder from inside the src
SupriyaAdep Aug 13, 2024
b15014d
add imports in customization api
SupriyaAdep Aug 13, 2024
9c1168f
add polling and wip customization index file
SupriyaAdep Aug 13, 2024
5ada6f1
undo pseudo code
SupriyaAdep Aug 13, 2024
6d84f2c
add poll sidebar
SupriyaAdep Aug 13, 2024
973d7c3
fix form validations
SupriyaAdep Aug 14, 2024
1ec58cb
Merge remote-tracking branch 'origin/custom-side-panel' into feature/…
SupriyaAdep Aug 14, 2024
950fda9
add polling card changes
SupriyaAdep Aug 14, 2024
72544a5
fix validations and publish poll result
SupriyaAdep Aug 14, 2024
a6667e1
add share modal
SupriyaAdep Aug 14, 2024
cd37920
fix resuable component
SupriyaAdep Aug 14, 2024
08e0a00
qip share poll modal
SupriyaAdep Aug 14, 2024
88c561a
add state for poll share
SupriyaAdep Aug 14, 2024
780adf1
change name from share to view
SupriyaAdep Aug 14, 2024
6398872
add more dropdown
SupriyaAdep Aug 20, 2024
0ada2c6
Updated toolbar to support label and on press customization
HariharanIT Aug 20, 2024
ac7c8b7
read channel attribute when user joins
SupriyaAdep Aug 21, 2024
e4f7cdb
add more actions
SupriyaAdep Aug 21, 2024
26cf5e7
add helpers
SupriyaAdep Aug 21, 2024
d6eb426
fix immutable changes
SupriyaAdep Aug 21, 2024
9eb9484
Merge branch 'custom-side-panel' into feature/polling
SupriyaAdep Aug 21, 2024
5b7e84e
fix download
SupriyaAdep Aug 21, 2024
4c39f47
change event map var
SupriyaAdep Aug 27, 2024
e7342e2
fix radio button
SupriyaAdep Aug 28, 2024
d65a223
add poll response view when in poll list for attendee
SupriyaAdep Aug 30, 2024
cd600e5
fix timer view
SupriyaAdep Sep 4, 2024
db83c71
vote view
SupriyaAdep Sep 4, 2024
d4b3f1a
remove log
SupriyaAdep Sep 4, 2024
518e0dc
remove unused component
SupriyaAdep Sep 6, 2024
9207365
modify some code related to poll api
SupriyaAdep Sep 10, 2024
f7076ff
add persistence
SupriyaAdep Sep 10, 2024
816296c
some poll sync state changes
SupriyaAdep Sep 10, 2024
b928170
add helper method and check if voted
SupriyaAdep Sep 10, 2024
6908520
change save implementation
SupriyaAdep Sep 10, 2024
f873291
changed the render response form
SupriyaAdep Sep 10, 2024
75002f3
hide radio and yes no section
SupriyaAdep Sep 10, 2024
11bd075
Merge branch 'preprod' into feature/polling
SupriyaAdep Sep 11, 2024
2466358
remove duplicate code
SupriyaAdep Sep 11, 2024
82feb1f
remove duplicate code
SupriyaAdep Sep 11, 2024
91034f2
fix importsd
SupriyaAdep Sep 11, 2024
1a03c56
merge polls functionality and change import
SupriyaAdep Sep 11, 2024
e8ea8ad
add style in action menu
SupriyaAdep Sep 11, 2024
ef79f2a
add polling header
SupriyaAdep Sep 11, 2024
e68cb92
fix the empty merged poll issue
SupriyaAdep Sep 11, 2024
6f4ac24
fix typo
SupriyaAdep Sep 11, 2024
b3f8c66
import config from customization api
SupriyaAdep Sep 12, 2024
e394efc
add code reviw changes
SupriyaAdep Sep 12, 2024
e4db0b8
remvoe unused code
SupriyaAdep Sep 12, 2024
e0b4a3b
Merge branch 'preprod' into feature/polling
SupriyaAdep Sep 26, 2024
66d9542
add new design changes
SupriyaAdep Sep 26, 2024
b49fb10
add extra settings field
SupriyaAdep Sep 26, 2024
4477a0c
add new ui designs to poll create
SupriyaAdep Sep 27, 2024
2ccfce7
preview ui new design
SupriyaAdep Sep 27, 2024
8ee318f
poll preview design
SupriyaAdep Sep 27, 2024
2ec0c97
fix the value for toggle
SupriyaAdep Sep 27, 2024
882affc
update toggle color
SupriyaAdep Sep 27, 2024
109ed64
fix the sidepanel padding and height issue
SupriyaAdep Sep 29, 2024
1d1ead3
add poll sidebar
SupriyaAdep Sep 29, 2024
dfeb535
add poll sidebar new design
SupriyaAdep Sep 30, 2024
e14ce27
poll card design changes
SupriyaAdep Sep 30, 2024
a91708c
fix the accordian list and item
SupriyaAdep Sep 30, 2024
6413e84
add draft state of card
SupriyaAdep Sep 30, 2024
fc997b7
border blue on option selected
SupriyaAdep Oct 1, 2024
196cece
poll response submit button
SupriyaAdep Oct 1, 2024
f54d03a
poll view and poll card changes
SupriyaAdep Oct 1, 2024
dddce6c
add poll permissions
SupriyaAdep Oct 1, 2024
3ed0735
view details check
SupriyaAdep Oct 1, 2024
17b85a5
add poll submit state transition
SupriyaAdep Oct 1, 2024
0056c89
sidebar content change and tpe change in context
SupriyaAdep Oct 2, 2024
5c39a93
submit button hidden on re-render
SupriyaAdep Oct 2, 2024
e887a8c
fix the percent logic
SupriyaAdep Oct 2, 2024
b1ce440
poll form and card changes
SupriyaAdep Oct 3, 2024
476e336
edit form object
SupriyaAdep Oct 3, 2024
9e5cdd9
add edit styling
SupriyaAdep Oct 3, 2024
7d569c9
update dropdown actions
SupriyaAdep Oct 3, 2024
cb9922d
add icon for accordian
SupriyaAdep Oct 3, 2024
588be7f
fix styling
SupriyaAdep Oct 3, 2024
8100f65
add icons in create poll
SupriyaAdep Oct 3, 2024
0786d19
fix the check and add log
SupriyaAdep Oct 3, 2024
8a139da
fix the colors of radio
SupriyaAdep Oct 3, 2024
8cd86b4
fix the styling of radio and basse button
SupriyaAdep Oct 4, 2024
0f21f52
poll submit changes
SupriyaAdep Oct 4, 2024
f7295a0
add poll bar icon
SupriyaAdep Oct 4, 2024
1b67ccd
add poll icons
SupriyaAdep Oct 4, 2024
7c07337
channel states
SupriyaAdep Oct 4, 2024
fdc5c9f
add changes
SupriyaAdep Oct 4, 2024
c1aa186
add debounce
SupriyaAdep Oct 6, 2024
3d7e200
fix sync state
SupriyaAdep Oct 7, 2024
3ee01d1
add empty states
SupriyaAdep Oct 7, 2024
66f0f46
remove advance settings for now
SupriyaAdep Oct 7, 2024
2d9205d
persistent user id needed to refer the polls
SupriyaAdep Oct 7, 2024
87879f0
Revert "persistent user id needed to refer the polls"
SupriyaAdep Oct 7, 2024
ad57898
fix logic
SupriyaAdep Oct 7, 2024
9e0b082
wrap in try catch
SupriyaAdep Oct 7, 2024
191c7f1
improve log quality
SupriyaAdep Oct 7, 2024
56a8967
null checks
SupriyaAdep Oct 7, 2024
58f70f4
fix rerender of useeffect
SupriyaAdep Oct 8, 2024
5cee855
add logs
SupriyaAdep Oct 8, 2024
0d06145
poll changes code refactoring
SupriyaAdep Oct 8, 2024
f639432
fix some issues
SupriyaAdep Oct 8, 2024
439733e
fix the race condition when accessing poll
SupriyaAdep Oct 8, 2024
5834d10
refactored modal states
SupriyaAdep Oct 8, 2024
cb6d99e
finished status
SupriyaAdep Oct 9, 2024
86a05af
stlying
SupriyaAdep Oct 9, 2024
61285a5
fix csv download
SupriyaAdep Oct 9, 2024
03cd709
open side panel when poll is closed without answering
SupriyaAdep Oct 9, 2024
1186e15
fix some hardcoded styles
SupriyaAdep Oct 9, 2024
15062ab
add correct magic var
SupriyaAdep Oct 9, 2024
eb68d3b
light theme fixes
SupriyaAdep Oct 9, 2024
693803c
add edit icon in preview form
SupriyaAdep Oct 10, 2024
b0d70a7
add poll icons helper
SupriyaAdep Oct 14, 2024
7b1e320
add icon in result modal
SupriyaAdep Oct 14, 2024
dea3a19
Merge branch 'preprod' into feature/polling
SupriyaAdep Oct 14, 2024
06e14a3
remove redundant imports
SupriyaAdep Oct 14, 2024
7c6c265
fix desc bug and default value of multiple response
SupriyaAdep Oct 15, 2024
109e4b3
fix the styling
SupriyaAdep Oct 15, 2024
2ea02dd
gap in response form
SupriyaAdep Oct 15, 2024
ef334b6
Merge branch 'preprod' into feature/polling
SupriyaAdep Oct 15, 2024
303b7b4
fix content padding
SupriyaAdep Oct 15, 2024
6acb8da
change the magic var bg coor
SupriyaAdep Oct 15, 2024
ac9a7ca
add few customizations for native
SupriyaAdep Oct 16, 2024
23dcbe6
fix native decvice buttons
SupriyaAdep Oct 16, 2024
10fa98e
open preview when clicked on launch
SupriyaAdep Oct 16, 2024
e20ac7b
Merge branch 'preprod' into feature/polling
SupriyaAdep Oct 17, 2024
d999de7
fix the space
SupriyaAdep Oct 17, 2024
a59cb1a
Merge branch 'preprod' into feature/polling
SupriyaAdep Oct 19, 2024
f1d6345
add qa ui feedbacks
SupriyaAdep Oct 21, 2024
57fd6d9
fix the uid bug
SupriyaAdep Oct 21, 2024
a9d2d4e
fix ts lint errors
SupriyaAdep Oct 21, 2024
ef5f99a
fix the first time load event
SupriyaAdep Oct 21, 2024
270533c
bug fix
SupriyaAdep Oct 22, 2024
b095ba3
add disabled to radiobox
SupriyaAdep Oct 22, 2024
dc6ec19
add disabled prop
SupriyaAdep Oct 22, 2024
2ce8e70
delete polls when user drops from the call
SupriyaAdep Oct 22, 2024
39105e2
add imports
SupriyaAdep Oct 23, 2024
ba5bdf6
fix min width
SupriyaAdep Oct 23, 2024
140a3b9
add prop to button
SupriyaAdep Oct 23, 2024
8b7270a
fix mobile styling
SupriyaAdep Oct 23, 2024
78581d9
Merge branch 'preprod' into feature/polling
SupriyaAdep Oct 24, 2024
62b617e
undo space
SupriyaAdep Oct 24, 2024
80c29b5
add changes
SupriyaAdep Oct 24, 2024
332f92e
push import fix
SupriyaAdep Oct 24, 2024
ab9de1f
rtm changes
SupriyaAdep Oct 24, 2024
5125ed9
native styling changes
SupriyaAdep Oct 24, 2024
4d0bd63
btn styling for native
SupriyaAdep Oct 25, 2024
fe3c9ef
fix all qa bugs
SupriyaAdep Oct 25, 2024
300eac2
fix the css property
SupriyaAdep Oct 28, 2024
0b91d8a
line-height issue
SupriyaAdep Oct 28, 2024
26b98b1
attribute length check
SupriyaAdep Oct 29, 2024
3fa26f3
add changes
SupriyaAdep Oct 29, 2024
e1bcada
fix live mode condition
SupriyaAdep Oct 29, 2024
36a5350
type error
SupriyaAdep Oct 29, 2024
9ff181c
delete polls fix
SupriyaAdep Oct 30, 2024
f57b7ce
fix wrapper
SupriyaAdep Oct 30, 2024
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
23 changes: 17 additions & 6 deletions template/bridge/rtm/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default class RtmEngine {
['channelMessageReceived', () => null],
['channelMemberJoined', () => null],
['channelMemberLeft', () => null],
['channelAttributesUpdated', () => null],
]);
public clientEventsMap = new Map<string, any>([
['connectionStateChanged', () => null],
Expand Down Expand Up @@ -67,8 +66,7 @@ export default class RtmEngine {
if (
event === 'channelMessageReceived' ||
event === 'channelMemberJoined' ||
event === 'channelMemberLeft' ||
event === 'channelAttributesUpdated'
event === 'channelMemberLeft'
) {
this.channelEventsMap.set(event, listener);
} else if (
Expand Down Expand Up @@ -253,7 +251,7 @@ export default class RtmEngine {
return acc;
}, []);

this.channelEventsMap.get('channelAttributesUpdated')(
this.channelEventsMap.get('ChannelAttributesUpdated')(
channelAttributes,
);
});
Expand Down Expand Up @@ -342,8 +340,21 @@ export default class RtmEngine {
let response = {};
await this.client
.getChannelAttributes(channelId)
.then((attributes: string) => {
response = {attributes};
.then((attributes: RtmChannelAttribute) => {
/**
* Here the attributes received are in the format {[valueOfKey]: valueOfValue} of type RtmChannelAttribute
* We need to convert it into (array of objects [{key: 'valueOfKey', value: 'valueOfValue}])
/**
* 1. Loop through object
* 2. Create a object {key: "", value: ""} and push into array
* 3. Return the Array
*/
const channelAttributes = Object.keys(attributes).reduce((acc, key) => {
const {value, lastUpdateTs, lastUpdateUserId} = attributes[key];
acc.push({key, value, lastUpdateTs, lastUpdateUserId});
return acc;
}, []);
response = channelAttributes;
})
.catch((e: any) => {
Promise.reject(e);
Expand Down
30 changes: 30 additions & 0 deletions template/customization/bottombar-native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import {ToolbarPreset, useSidePanel} from 'customization-api';
import {
PollButtonSidePanelTrigger,
POLL_SIDEBAR_NAME,
} from './polling/components/PollButtonSidePanelTrigger';

const NativeBottomToolbar = () => {
const {setSidePanel} = useSidePanel();

return (
<ToolbarPreset
align="bottom"
items={{
more: {
fields: {
poll: {
component: PollButtonSidePanelTrigger,
onPress: () => {
setSidePanel(POLL_SIDEBAR_NAME);
},
},
},
},
}}
/>
);
};

export default NativeBottomToolbar;
28 changes: 28 additions & 0 deletions template/customization/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {$config, customize} from 'customization-api';
import NativeBottomToolbar from './bottombar-native';
import PollSidebar from './polling/components/PollSidebar';
import Poll from './polling/components/Poll';
import {POLL_SIDEBAR_NAME} from './polling/components/PollButtonSidePanelTrigger';

const config = customize({
components: {
videoCall: {
wrapper: Poll,
bottomToolBar: NativeBottomToolbar,
customSidePanel: () => {
return [
{
name: POLL_SIDEBAR_NAME,
component: PollSidebar,
title: 'Polls',
onClose: () => {},
},
];
},
},
},
});

const isLiveMode = $config.AUDIO_ROOM || $config.EVENT_MODE;

export default isLiveMode ? {} : config;
3 changes: 3 additions & 0 deletions template/customization/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "customization"
}
87 changes: 87 additions & 0 deletions template/customization/polling/components/Poll.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import React, {useMemo, useCallback} from 'react';
import {PollModalType, PollProvider, usePoll} from '../context/poll-context';
import PollFormWizardModal from './modals/PollFormWizardModal';
import {PollEventsProvider, PollEventsSubscriber} from '../context/poll-events';
import PollResponseFormModal from './modals/PollResponseFormModal';
import PollResultModal from './modals/PollResultModal';
import PollConfirmModal from './modals/PollEndConfirmModal';
import PollItemNotFound from './modals/PollItemNotFound';
import {log} from '../helpers';

function Poll({children}: {children?: React.ReactNode}) {
return (
<PollEventsProvider>
<PollProvider>
<PollEventsSubscriber>
{children}
<PollModals />
</PollEventsSubscriber>
</PollProvider>
</PollEventsProvider>
);
}

function PollModals() {
const {modalState, polls} = usePoll();
// Log only in development mode to prevent performance hits
if (process.env.NODE_ENV === 'development') {
log('polls data changed: ', polls);
}

const renderModal = useCallback(() => {
switch (modalState.modalType) {
case PollModalType.DRAFT_POLL:
if (modalState.id && polls[modalState.id]) {
const editFormObject = {...polls[modalState.id]};
return (
<PollFormWizardModal formObject={editFormObject} formStep="DRAFT" />
);
}
return <PollFormWizardModal formStep="SELECT" />;
case PollModalType.PREVIEW_POLL:
if (modalState.id && polls[modalState.id]) {
const previewFormObject = {...polls[modalState.id]};
return (
<PollFormWizardModal
formObject={previewFormObject}
formStep="PREVIEW"
/>
);
}
break;
case PollModalType.RESPOND_TO_POLL:
if (modalState.id && polls[modalState.id]) {
return <PollResponseFormModal pollId={modalState.id} />;
}
return <PollItemNotFound />;
case PollModalType.VIEW_POLL_RESULTS:
if (modalState.id && polls[modalState.id]) {
return <PollResultModal pollId={modalState.id} />;
}
return <PollItemNotFound />;
case PollModalType.END_POLL_CONFIRMATION:
if (modalState.id && polls[modalState.id]) {
return <PollConfirmModal actionType="end" pollId={modalState.id} />;
}
return <PollItemNotFound />;
case PollModalType.DELETE_POLL_CONFIRMATION:
if (modalState.id && polls[modalState.id]) {
return (
<PollConfirmModal actionType="delete" pollId={modalState.id} />
);
}
return <PollItemNotFound />;
case PollModalType.NONE:
break;
default:
log('Unknown modal type: ', modalState);
return <></>;
}
}, [modalState, polls]);

const memoizedModal = useMemo(() => renderModal(), [renderModal]);

return <>{memoizedModal}</>;
}

export default Poll;
86 changes: 86 additions & 0 deletions template/customization/polling/components/PollAvatarHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {Text, View, StyleSheet} from 'react-native';
import React from 'react';
import {PollItem} from '../context/poll-context';
import {
useContent,
UserAvatar,
ThemeConfig,
useString,
videoRoomUserFallbackText,
UidType,
$config,
} from 'customization-api';

interface Props {
pollItem: PollItem;
}

function PollAvatarHeader({pollItem}: Props) {
const remoteUserDefaultLabel = useString(videoRoomUserFallbackText)();
const {defaultContent} = useContent();

const getPollCreaterName = ({uid, name}: {uid: UidType; name: string}) => {
return defaultContent[uid]?.name || name || remoteUserDefaultLabel;
};

return (
<View style={style.titleCard}>
<View style={style.titleAvatar}>
<UserAvatar
name={getPollCreaterName(pollItem.createdBy)}
containerStyle={style.titleAvatarContainer}
textStyle={style.titleAvatarContainerText}
/>
</View>
<View style={style.title}>
<Text style={style.titleText}>
{getPollCreaterName(pollItem.createdBy)}
</Text>
<Text style={style.titleSubtext}>{pollItem.type}</Text>
</View>
</View>
);
}
export const style = StyleSheet.create({
titleCard: {
display: 'flex',
flexDirection: 'row',
gap: 12,
},
title: {
display: 'flex',
flexDirection: 'column',
gap: 2,
},
titleAvatar: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
titleAvatarContainer: {
width: 36,
height: 36,
borderRadius: 18,
backgroundColor: $config.VIDEO_AUDIO_TILE_AVATAR_COLOR,
},
titleAvatarContainerText: {
fontSize: ThemeConfig.FontSize.small,
lineHeight: 16,
fontWeight: '600',
color: $config.VIDEO_AUDIO_TILE_COLOR,
},
titleText: {
color: $config.FONT_COLOR,
fontSize: ThemeConfig.FontSize.normal,
fontWeight: '700',
lineHeight: 20,
},
titleSubtext: {
color: $config.FONT_COLOR,
fontSize: ThemeConfig.FontSize.tiny,
fontWeight: '400',
lineHeight: 16,
},
});

export default PollAvatarHeader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import React from 'react';
import {
useSidePanel,
ToolbarItem,
ImageIcon,
ThemeConfig,
$config,
useActionSheet,
IconButton,
IconButtonProps,
} from 'customization-api';
import {View, Text, StyleSheet} from 'react-native';
import pollIcons from '../poll-icons';

const POLL_SIDEBAR_NAME = 'side-panel-poll';

const PollButtonSidePanelTrigger = () => {
const {isOnActionSheet} = useActionSheet();
const {sidePanel, setSidePanel} = useSidePanel();

const isPollPanelActive = sidePanel === POLL_SIDEBAR_NAME;
// On smaller screens
if (isOnActionSheet) {
const iconButtonProps: IconButtonProps = {
onPress: () => {
setSidePanel(POLL_SIDEBAR_NAME);
},
iconProps: {
icon: pollIcons['bar-chart'],
tintColor: isPollPanelActive
? $config.PRIMARY_ACTION_TEXT_COLOR
: $config.SECONDARY_ACTION_COLOR,
iconBackgroundColor: isPollPanelActive
? $config.PRIMARY_ACTION_BRAND_COLOR
: '',
},
btnTextProps: {
text: 'Polls',
textColor: $config.FONT_COLOR,
numberOfLines: 1,
textStyle: {
marginTop: 8,
},
},
isOnActionSheet: isOnActionSheet,
};

return (
<ToolbarItem>
<IconButton {...iconButtonProps} />
</ToolbarItem>
);
}
// On bigger screens
return (
<ToolbarItem style={{...style.toolbarItem, ...style.spacing}}>
<View style={style.toolbarImg}>
<ImageIcon
iconType="plain"
iconSize={22}
icon={pollIcons['bar-chart']}
tintColor={$config.SECONDARY_ACTION_COLOR}
/>
</View>
<Text style={style.toolbarText}>Polls</Text>
</ToolbarItem>
);
};

export {PollButtonSidePanelTrigger, POLL_SIDEBAR_NAME};

const style = StyleSheet.create({
toolbarItem: {
display: 'flex',
flexDirection: 'row',
},
toolbarImg: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginRight: 8,
},
toolbarText: {
color: $config.SECONDARY_ACTION_COLOR,
fontSize: ThemeConfig.FontSize.normal,
fontWeight: '400',
fontFamily: ThemeConfig.FontFamily.sansPro,
},
spacing: {
margin: 12,
},
});
Loading