mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
bill fix this
This commit is contained in:
parent
e268a5a459
commit
81d1a2910a
@ -161,12 +161,15 @@ export const ModToolsView: FC<ModToolsViewProps> = props =>
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
const data = parser.data;
|
||||
|
||||
dispatchModToolsState({
|
||||
type: ModToolsActions.SET_INIT_DATA,
|
||||
payload: {
|
||||
settings: parser.data
|
||||
settings: data
|
||||
}
|
||||
});
|
||||
console.log(parser);
|
||||
}, []);
|
||||
|
||||
CreateMessageHook(ModeratorInitMessageEvent, onModeratorInitMessageEvent);
|
||||
|
@ -1,6 +0,0 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
export const ModToolsOpenIssuesTabView: FC<{}> = props =>
|
||||
{
|
||||
return null;
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
import { FC, useCallback, useState } from 'react';
|
||||
import { IssueMessageData } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useMemo, useState } from 'react';
|
||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../../../layout';
|
||||
import { ModToolsOpenIssuesTabView } from './ModToolsOpenIssuesTabView';
|
||||
import { useModToolsContext } from '../../context/ModToolsContext';
|
||||
import { ModToolsTicketsViewProps } from './ModToolsTicketsView.types';
|
||||
import { ModToolsOpenIssuesTabView } from './open-issues/ModToolsOpenIssuesTabView';
|
||||
|
||||
const TABS: string[] = [
|
||||
'Open Issues',
|
||||
@ -12,17 +14,27 @@ const TABS: string[] = [
|
||||
export const ModToolsTicketsView: FC<ModToolsTicketsViewProps> = props =>
|
||||
{
|
||||
const { onCloseClick = null } = props;
|
||||
|
||||
const { modToolsState = null } = useModToolsContext();
|
||||
const { settings = null } = modToolsState;
|
||||
const [ currentTab, setCurrentTab ] = useState<number>(0);
|
||||
|
||||
const openIssues = useMemo(() =>
|
||||
{
|
||||
if(!settings) return [];
|
||||
|
||||
return settings.issues.filter(issue => issue.state === IssueMessageData.STATE_OPEN)
|
||||
}, [settings]);
|
||||
|
||||
const CurrentTabComponent = useCallback(() =>
|
||||
{
|
||||
switch(currentTab)
|
||||
{
|
||||
case 0: return <ModToolsOpenIssuesTabView />;
|
||||
case 0: return <ModToolsOpenIssuesTabView openIssues={openIssues}/>;
|
||||
default: return null;
|
||||
}
|
||||
}, [currentTab]);
|
||||
}, [currentTab, openIssues]);
|
||||
|
||||
console.log(settings);
|
||||
|
||||
return (
|
||||
<NitroCardView className="nitro-mod-tools-tickets" simple={ false }>
|
||||
@ -37,7 +49,7 @@ export const ModToolsTicketsView: FC<ModToolsTicketsViewProps> = props =>
|
||||
}) }
|
||||
</NitroCardTabsView>
|
||||
<div className="p-2">
|
||||
<CurrentTabComponent />
|
||||
{settings && <CurrentTabComponent /> }
|
||||
</div>
|
||||
</NitroCardContentView>
|
||||
</NitroCardView>
|
||||
|
@ -0,0 +1,11 @@
|
||||
import { FC } from 'react';
|
||||
import { ModToolsOpenIssuesTabViewProps } from './ModToolsOpenIssuesTabView.types';
|
||||
|
||||
export const ModToolsOpenIssuesTabView: FC<ModToolsOpenIssuesTabViewProps> = props =>
|
||||
{
|
||||
const { openIssues = null } = props;
|
||||
|
||||
return (
|
||||
<div>{openIssues.length}</div>
|
||||
);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
import { IssueMessageData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export interface ModToolsOpenIssuesTabViewProps
|
||||
{
|
||||
openIssues: IssueMessageData[];
|
||||
}
|
Loading…
Reference in New Issue
Block a user