fix(ui): fix assist tab clicking

This commit is contained in:
nick-delirium 2023-07-07 11:07:38 +02:00
parent 57247193d8
commit aa375cf47c
3 changed files with 7 additions and 4 deletions

View file

@ -14,7 +14,7 @@ function SubHeader() {
return (
<>
<div className="w-full px-4 pt-2 flex items-center border-b min-h-3">
<SessionTabs />
<SessionTabs isLive />
</div>
{location && (
<div className={'w-full bg-white border-b border-gray-light'}>

View file

@ -35,7 +35,7 @@ function Modal({ tabs, currentTab, changeTab, hideModal }: Props) {
);
}
function SessionTabs() {
function SessionTabs({ isLive }: { isLive?: boolean }) {
const { showModal, hideModal } = useModal();
const { player, store } = React.useContext(PlayerContext);
const { tabs = new Set('back-compat'), currentTab } = store.get();
@ -52,6 +52,7 @@ function SessionTabs() {
idx: tabsArr.findIndex((tEl) => tEl.tab === currentTab),
});
const changeTab = (tab: string) => {
if (isLive) return;
player.changeTab(tab);
};
@ -72,6 +73,7 @@ function SessionTabs() {
tab={tab.tab}
currentTab={actualTabs.length === 1 ? tab.tab : currentTab}
changeTab={changeTab}
isLive={isLive}
/>
</React.Fragment>
))}

View file

@ -6,9 +6,10 @@ interface Props {
tab: string;
currentTab: string;
changeTab?: (tab: string) => void;
isLive?: boolean;
}
function Tab({ i, tab, currentTab, changeTab }: Props) {
function Tab({ i, tab, currentTab, changeTab, isLive }: Props) {
return (
<div
key={tab}
@ -16,7 +17,7 @@ function Tab({ i, tab, currentTab, changeTab }: Props) {
onClick={() => changeTab?.(tab)}
className={cn(
'self-end py-1 px-4 text-sm',
changeTab && 'cursor-pointer',
changeTab && !isLive ? 'cursor-pointer' : 'cursor-default',
currentTab === tab
? 'border-gray-light border-t border-l border-r !border-b-white bg-white rounded-tl rounded-tr font-semibold'
: 'cursor-pointer border-gray-light !border-b !border-t-transparent !border-l-transparent !border-r-transparent'