Skip to content

Commit dd6d341

Browse files
Merge pull request #102 from openbankingnigeria/web
Web
2 parents 9ddad39 + 34254b2 commit dd6d341

23 files changed

+994
-171
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use client'
2+
3+
import React from 'react';
4+
// import dynamic from 'next/dynamic';
5+
import MonacoEditor from 'react-monaco-editor';
6+
import { CodeEditorProps } from '@/types/webappTypes/componentsTypes';
7+
// const MonacoEditor = dynamic(import('react-monaco-editor'), { ssr: false });
8+
9+
const CodeEditor = ({
10+
code,
11+
setCode
12+
}: CodeEditorProps) => {
13+
14+
const handleEditorChange = (newCode: string, event: any) => {
15+
setCode(newCode);
16+
};
17+
18+
const options = {
19+
autoIndent: 'full',
20+
contextmenu: true,
21+
fontFamily: 'monospace',
22+
fontSize: 13,
23+
lineHeight: 24,
24+
hideCursorInOverviewRuler: true,
25+
matchBrackets: 'always',
26+
minimap: {
27+
enabled: true,
28+
},
29+
scrollbar: {
30+
horizontalSliderSize: 4,
31+
verticalSliderSize: 18,
32+
},
33+
selectOnLineNumbers: true,
34+
roundedSelection: false,
35+
readOnly: false,
36+
cursorStyle: 'line',
37+
automaticLayout: true,
38+
};
39+
40+
return (
41+
<div className='w-full rounded-[6px] overflow-hidden'>
42+
<MonacoEditor
43+
width="800"
44+
height="400"
45+
language="javascript"
46+
theme="vs-dark"
47+
value={code}
48+
defaultValue={code}
49+
// options={options}
50+
onChange={handleEditorChange}
51+
/>
52+
</div>
53+
)
54+
}
55+
56+
export default CodeEditor

apps/web/app/(webapp)/(components)/EmptyState.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { EmptyStateProps } from '@/types/webappTypes/componentsTypes';
22
import React from 'react';
3-
import { EmptyStateButton } from '.';
3+
import { AddPermissionButton } from '../app/api-management/consumers/(components)';
44

55
const EmptyState = ({
66
type,
77
title,
88
body,
99
parentStyle,
1010
titleStyle,
11+
searchQuery,
12+
altData,
1113
bodyStyle,
1214
iconStyle,
1315
containerStyle,
@@ -77,8 +79,14 @@ const EmptyState = ({
7779
</div>
7880

7981
{
80-
button &&
81-
<EmptyStateButton type={buttonType} />
82+
button && (
83+
buttonType == 'ADD_PERMISSIONS' ?
84+
<AddPermissionButton
85+
searchQuery={searchQuery || ''}
86+
customerId={altData}
87+
/>
88+
: null
89+
)
8290
}
8391
</div>
8492
</section>

apps/web/app/(webapp)/(components)/EmptyStateButton.tsx

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
'use client'
2+
3+
import { ListPanelContainerProps } from '@/types/webappTypes/componentsTypes'
4+
import React, { useEffect, useState } from 'react';
5+
import { motion } from 'framer-motion';
6+
import { getObjectsNotInArrayB } from '@/utils/getObjectNotInArray';
7+
8+
const ListPanel = ({
9+
panel,
10+
currentValue,
11+
setCurrentValue,
12+
containerStyle
13+
}: ListPanelContainerProps) => {
14+
15+
const [panelOut, setPanelOut] = useState<any[]>([]);
16+
const panelRemaining = getObjectsNotInArrayB(panel, panelOut);
17+
18+
useEffect(() => {
19+
setPanelOut([panel[0]]);
20+
}, []);
21+
22+
const handlePanelList = (data: any) => {
23+
if (panelOut?.find((item: any) => item?.id == data?.id)) {
24+
const filteredItem = panelOut?.filter(item => item?.id != data?.id);
25+
setPanelOut(filteredItem);
26+
} else {
27+
setPanelOut((prev: any) => [...prev, data]);
28+
}
29+
}
30+
31+
return (
32+
<div className={`bg-white border-b border-o-border
33+
flex items-center gap-[16px] h-[40px] w-full ${containerStyle}`}
34+
>
35+
{
36+
panelOut?.map((data) => (
37+
<div
38+
key={data?.id}
39+
className='relative whitespace-nowrap cursor-pointer w-fit flex flex-col px-[4px] pt-[9px] pb-[11px]'
40+
onClick={() => setCurrentValue(data?.value)}
41+
>
42+
<div className={`${currentValue == data?.value ? 'text-o-blue font-[500]' : 'text-o-text-medium3'}
43+
capitalize text-f14 hover:text-o-blue`}
44+
>
45+
{data?.label}
46+
</div>
47+
48+
{
49+
currentValue == data?.value &&
50+
<motion.div
51+
className='pane-underline'
52+
layoutId='top-pane-underline'
53+
></motion.div>
54+
}
55+
</div>
56+
))
57+
}
58+
59+
<div className='flex flex-col relative'>
60+
<button type='button' className='peer' onClick={(e) => e.stopPropagation()}>
61+
<svg width="28" height="30" viewBox="0 0 28 30" fill="none" xmlns="http://www.w3.org/2000/svg">
62+
<rect width="28" height="30" rx="4" fill="#F6F8FA"/>
63+
<path d="M13.9998 8.16602V19.8327M8.1665 13.9993H19.8332" stroke="#666D80" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
64+
<rect x="4" y="28" width="20" height="2" fill="#DCE3E8" fillOpacity="0.01"/>
65+
</svg>
66+
</button>
67+
68+
<div className='hidden peer-focus:flex hover:flex absolute bg-white rounded-lg flex-col z-10 border border-o-border right-0 top-[30px] py-[4px] w-[158px] items-start justify-start tablemenu-boxshadow'>
69+
{
70+
panelRemaining?.map((data) => (
71+
<button
72+
key={data.id}
73+
className='whitespace-nowrap cursor-pointer hover:bg-o-bg-disabled w-full flex gap-[12px] items-center py-[10px] px-[16px] text-o-text-dark text-f14'
74+
onClick={() => handlePanelList(data)}
75+
>
76+
<span className='whitespace-nowrap'>
77+
{data.label}
78+
</span>
79+
</button>
80+
))
81+
}
82+
</div>
83+
</div>
84+
</div>
85+
)
86+
}
87+
88+
export default ListPanel

apps/web/app/(webapp)/(components)/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import TierBox from "./TierBox";
2727
import DownloadButton from "./DownloadButton";
2828
import DragAndUploadFile from "./DragAndUploadFile";
2929
import KybBanner from "./KybBanner";
30-
import EmptyStateButton from "./EmptyStateButton";
30+
import ListPanel from "./ListPanel";
31+
import CodeEditor from "./CodeEditor";
3132

3233
export {
3334
DatePicker,
@@ -59,5 +60,6 @@ export {
5960
TierBox,
6061
DownloadButton,
6162
DragAndUploadFile,
62-
EmptyStateButton
63+
ListPanel,
64+
CodeEditor
6365
}

0 commit comments

Comments
 (0)