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

Chat UI #2931

Open
wants to merge 168 commits into
base: main
Choose a base branch
from
Open

Chat UI #2931

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
cfd2d10
Tweak shared components for chat UI
niwsa Jul 15, 2024
11277f6
Add LLM packages
niwsa Jul 17, 2024
901ca3e
Merge branch 'main' into chatui
niwsa Jul 17, 2024
abb223e
ChatController WIP
niwsa Jul 18, 2024
ad918cf
`createConversation`, `createChat` and `getConversationById`
niwsa Jul 18, 2024
e4055b9
Add index for conversation
niwsa Jul 18, 2024
127d2fd
Remove LLMChat member
niwsa Jul 18, 2024
580765f
`put` doesn't return anything, manually return the created object
niwsa Jul 18, 2024
646a33d
TeamId will be optional and in case of admin portal just use userId f…
niwsa Jul 18, 2024
89bb54c
Remove `getAllConversations` as retrieval will be via an index
niwsa Jul 21, 2024
ed2033a
Merge branch 'main' into chatui
niwsa Jul 21, 2024
cd82e28
Add `zod` validation
niwsa Jul 22, 2024
17cda0a
LLM handler and env additions
niwsa Jul 22, 2024
e29b3dd
Add terminus/llm opts
niwsa Jul 22, 2024
07baf67
Switch `teamId` with `tenant`, Add methods for managing LLM configs
niwsa Jul 22, 2024
d84e762
Expose `chatController` from npm
niwsa Jul 22, 2024
d149007
`apiKey` and `baseURL` should be optional
niwsa Jul 22, 2024
2a35a58
Return the config object after save
niwsa Jul 22, 2024
0a27ce0
API route for fetching and saving LLM configs
niwsa Jul 22, 2024
34ecf15
`deleteLLMConfig` implementation
niwsa Jul 22, 2024
f6020b7
Fixes for `deleteLLMConfig`
niwsa Jul 23, 2024
8e0aad1
Add `updateLLMConfig` method
niwsa Jul 23, 2024
e2c7278
API route for updating/deleting LLM configs
niwsa Jul 23, 2024
9b2c528
Add internals API route
niwsa Jul 23, 2024
3e1eef2
Merge branch 'main' into chatui
niwsa Jul 23, 2024
1ff0647
Move api under `[tenant]`
niwsa Jul 23, 2024
5d42b11
Merge branch 'main' of ssh://github.com/boxyhq/jackson
niwsa Jul 23, 2024
9cbef62
Merge branch 'main' into chatui
niwsa Jul 23, 2024
74da24f
Minor formatting for env
niwsa Jul 23, 2024
82da327
Move under `[tenant]` slug
niwsa Jul 23, 2024
3655df4
Add missing tenant to schema
niwsa Jul 23, 2024
9819d23
Admin portal API route and add env for admin portal vault tenant
niwsa Jul 23, 2024
356d664
Use tenant from schema
niwsa Jul 23, 2024
0e51b44
Index chat by conversationId
niwsa Jul 23, 2024
4e6a0fc
Add `getChatByConversationId`
niwsa Jul 23, 2024
89898b5
API routes for fetching conversation(s)
niwsa Jul 23, 2024
4048489
Add composite index and tenant/product for llmconfig, remove User index
niwsa Jul 23, 2024
d0db1fa
Refactor llm handlers logic
niwsa Jul 24, 2024
b692d1d
API routes for generating chat response from LLM
niwsa Jul 24, 2024
4febbc0
Export chat controller types
niwsa Jul 24, 2024
08dcf76
Append `user.id` to session (for indexing conversation by userId)
niwsa Jul 24, 2024
47a45cc
Use `defaultHandler` for new API routes
niwsa Jul 24, 2024
70e9589
API route for uploading file
niwsa Jul 25, 2024
40a4a41
Add ChatContext
niwsa Jul 26, 2024
7032ee4
Add `getLLMProviders`, Use merged type for getLLMConfigs return
niwsa Jul 26, 2024
667b9b5
Import type from jackson
niwsa Jul 26, 2024
b4f8e1e
API route for fetching provider/model list
niwsa Jul 26, 2024
ec6df22
Add `createdAt` timestamp to chat
niwsa Jul 26, 2024
96be377
Rename method
niwsa Jul 26, 2024
bcf1fd7
Merge branch 'main' of ssh://github.com/boxyhq/jackson
niwsa Jul 26, 2024
89cb0e8
Merge branch 'main' into chatui
niwsa Jul 26, 2024
65ca4cb
Type updates
niwsa Jul 27, 2024
53c11a0
Filter provider options list by tenant (default behavior) else return…
niwsa Jul 27, 2024
9a08ecd
Add Chat UI page
niwsa Jul 29, 2024
20d3b5a
Tweak zod validation to receive providers dynamically from controller
niwsa Jul 29, 2024
ff7b68a
Chat components under internal-ui
niwsa Jul 29, 2024
178aeba
Fix usage of terminus host url from env
niwsa Jul 29, 2024
7fab88a
Cleanup lib file
niwsa Jul 29, 2024
f6e5f34
Fix return object and add `createdAt` field
niwsa Jul 29, 2024
b11d7e8
Add `getLLMModels` to retrieve models of a provider (with filtering b…
niwsa Jul 29, 2024
907c524
Fix return object
niwsa Jul 29, 2024
90d41f2
Fix user id extraction
niwsa Jul 29, 2024
91d52b5
Minor fix
niwsa Jul 29, 2024
22cb35e
Merge branch 'main' of ssh://github.com/boxyhq/jackson
niwsa Jul 29, 2024
b33cea6
Merge branch 'main' into chatui
niwsa Jul 29, 2024
2cd47dd
Fix formatting
niwsa Jul 29, 2024
0de9ccd
Fix locale
niwsa Jul 29, 2024
a45fd5f
Switch to `getServerSideProps`
niwsa Jul 29, 2024
1a4cc9e
Store conversation id in value
niwsa Jul 30, 2024
c006d36
Sort chat thread in ascending order before returning
niwsa Jul 30, 2024
7a76f11
- Clear states when url is reset
niwsa Jul 31, 2024
8ebbe68
Store id along with chat value
niwsa Jul 31, 2024
3596807
Use optional catch all route for Chat page
niwsa Jul 31, 2024
1dcf944
Update type
niwsa Jul 31, 2024
4d0b888
Squash routing/state update bugs in components
niwsa Jul 31, 2024
729904a
Merge branch 'main' of ssh://github.com/boxyhq/jackson
niwsa Jul 31, 2024
63ef34e
Merge branch 'main' into chatui
niwsa Jul 31, 2024
270c3a4
Minor cleanups
niwsa Jul 31, 2024
918effb
Move under ee pages, add license check
niwsa Jul 31, 2024
092264c
refactor: Skip processing empty or zero-length choices in handlePOST …
ukrocks007 Aug 1, 2024
51c93bf
Disable bodyparser in main api file, parse form data instead of pipin…
niwsa Aug 3, 2024
78a6b8f
Store config id along with payload
niwsa Aug 5, 2024
66730da
Use old api key if passed api key is empty
niwsa Aug 6, 2024
6abb65b
Add `isChatWithPDFProvider` flag
niwsa Aug 6, 2024
8143d68
Fix locale keys
niwsa Aug 6, 2024
41bdd1a
Merge branch 'main' of ssh://github.com/boxyhq/jackson
niwsa Aug 6, 2024
4fde118
Merge branch 'main' into chatui
niwsa Aug 6, 2024
1c96c53
Enable ollama in useTerminus configuration
niwsa Aug 6, 2024
8dc4aa2
Fix file upload spinner styling
niwsa Aug 6, 2024
c2665fd
Handle provider/model selection for chat with pdf
niwsa Aug 6, 2024
052dda5
View logic for chat with pdf
niwsa Aug 6, 2024
f141d20
Type updates plus chat with pdf handling
niwsa Aug 6, 2024
cdf9d87
Fix chat with pdf on previous conversation
niwsa Aug 6, 2024
580fb43
Filter out chat with pdf provider
niwsa Aug 6, 2024
9758790
Update example env
niwsa Aug 8, 2024
0b8a93e
Move tenant/product under terminus options
niwsa Aug 8, 2024
0a109c0
Merge branch 'main' into chatui
niwsa Aug 8, 2024
bfb49d4
Update env vars for LLM File chat
niwsa Aug 8, 2024
19bbdaa
JWE generation for PDF chat
niwsa Aug 9, 2024
529975f
Fix conditional logic for chat with PDF
niwsa Aug 9, 2024
635641d
Enable terminus proxy for PDF Chat
niwsa Aug 9, 2024
ebcbfb5
Generate JWT instead of JWE
niwsa Aug 10, 2024
18cf1ea
API Key would be dummy for PDF chat
niwsa Aug 10, 2024
c9fdcdd
Include `tenant` as part of api-key
niwsa Aug 10, 2024
37bc7e3
Update env to signing key
niwsa Aug 12, 2024
72e97dd
Collapse sidebar by default
niwsa Aug 13, 2024
cb11996
Source jwt env
niwsa Aug 18, 2024
5f06688
Fix hidden class logic
niwsa Aug 18, 2024
bc61aa6
Close sidebar on click outside and esc
niwsa Aug 18, 2024
16d8242
Merge branch 'main' into chatui
niwsa Aug 19, 2024
90e8e72
Fix eslint errors
niwsa Aug 19, 2024
62909ae
Sync lock file
niwsa Aug 19, 2024
5d4adee
Sync lock file
niwsa Aug 19, 2024
2023a1b
one more try
deepakprabhakara Aug 19, 2024
74971cc
Debug vite package issue
niwsa Aug 19, 2024
946fdd1
Merge branch 'chatui' of ssh://github.com/boxyhq/jackson into chatui
niwsa Aug 19, 2024
9eb93a8
Fix `npm prune` step
niwsa Aug 19, 2024
9c22585
one more round of cleanup
deepakprabhakara Aug 19, 2024
33d089f
cleanup
deepakprabhakara Aug 19, 2024
173acd6
Merge branch 'main' into chatui
niwsa Aug 19, 2024
0c70358
Lock file update
niwsa Aug 19, 2024
5c9a3b5
Merge branch 'main' into chatui
deepakprabhakara Aug 19, 2024
181472b
Merge branch 'main' into chatui
deepakprabhakara Aug 19, 2024
2e26f1d
installed sharp deps
deepakprabhakara Aug 19, 2024
0508f29
Merge branch 'main' into chatui
niwsa Aug 20, 2024
34e986f
Lock file update
niwsa Aug 20, 2024
cd54426
Revert sidebar collapse, fix duplicate react types issue
niwsa Aug 20, 2024
42419b6
Merge branch 'main' into chatui
niwsa Sep 18, 2024
47f5497
Lock file changes
niwsa Sep 18, 2024
63e30f8
Remove unused env
niwsa Sep 23, 2024
1a54562
Also send provider while saving config
niwsa Sep 25, 2024
dd26615
Merge branch 'main' into chatui
niwsa Sep 25, 2024
171d549
`npm update`
niwsa Sep 25, 2024
bb58fbc
Move Chat above settings
niwsa Sep 26, 2024
7f6faad
Add scroll if content overflows
niwsa Sep 26, 2024
15665f3
Merge branch 'main' into chatui
niwsa Sep 26, 2024
b60a42f
Remove whitespace in layout
niwsa Sep 26, 2024
2823e2a
Block thread access if userId does not match
niwsa Sep 30, 2024
d1b982e
Merge branch 'main' into chatui
deepakprabhakara Sep 30, 2024
8b718a4
Merge branch 'main' into chatui
niwsa Oct 1, 2024
d7c1b7e
Default to openai in provider dropdown
niwsa Oct 1, 2024
d0c57a1
Use flag to enable chat feature
niwsa Oct 3, 2024
2ba17a6
Fix type error
niwsa Oct 3, 2024
f36fd79
Merge branch 'main' into chatui
niwsa Oct 3, 2024
d8e9327
Send 404 if feature not enabled
niwsa Oct 3, 2024
14b2f2f
Use generic api for feature toggling
niwsa Oct 4, 2024
45649a2
Merge branch 'main' into chatui
niwsa Oct 4, 2024
da73f69
Merge branch 'main' into chatui
niwsa Oct 23, 2024
11fec25
Merge branch 'main' into chatui
deepakprabhakara Nov 7, 2024
e8f282f
Merge branch 'main' into chatui
deepakprabhakara Nov 7, 2024
9af541c
Collapsible sidebar navigation
niwsa Nov 8, 2024
8edd11a
Fix type error
niwsa Nov 8, 2024
402031c
Don't collapse sidebar by default
niwsa Nov 8, 2024
ed5af68
Remove autoclose on link click
niwsa Nov 8, 2024
9f78066
Fix type error
niwsa Nov 8, 2024
e09eaf9
added detect_anonymize
deepakprabhakara Nov 8, 2024
7a76242
Fix overflowing main body
niwsa Nov 8, 2024
405bc68
[e2e] Fix button locator
niwsa Nov 8, 2024
6dfe5d4
Set overflow for main
niwsa Nov 8, 2024
9300528
typo
deepakprabhakara Nov 8, 2024
54618c5
blockly tweaks
deepakprabhakara Nov 8, 2024
3bc8e71
Fix locator
niwsa Nov 9, 2024
d2f8514
Style and layout fixes
niwsa Nov 9, 2024
e6add4b
tweak
deepakprabhakara Nov 12, 2024
8f853b4
added license check for Terminus
deepakprabhakara Nov 12, 2024
0e983e6
added audit-logs page to LLM Vault
deepakprabhakara Nov 13, 2024
34a4ff8
Merge commit 'adbf7dd7b12e892bc744447b735e1b4ced20e66e' into chatui
deepakprabhakara Nov 13, 2024
e3cedc9
lint fix
deepakprabhakara Nov 13, 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
14 changes: 13 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ TERMINUS_PROXY_HOST_URL=
TERMINUS_ADMIN_ROOT_TOKEN=
# Set this env to enable vault audit logs in the sidebar
TERMINUS_RETRACED_PROJECT_ID=
TERMINUS_LLM_RETRACED_PROJECT_ID=

# OpenTelemetry
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=
Expand Down Expand Up @@ -115,4 +116,15 @@ ENTERPRISE_ORY_PROJECT_ID=
#OPENID_REQUEST_PROFILE_SCOPE=false

# Uncomment below if you wish to forward the OpenID params (https://openid.net/specs/openid-connect-core-1_0-errata2.html#AuthRequest) to the OpenID IdP
#OPENID_REQUEST_FORWARD_PARAMS=true
#OPENID_REQUEST_FORWARD_PARAMS=true
FEATURE_LLM_VAULT=
LLM_PDF_CHAT_BASE_URL=
LLM_PDF_CHAT_ROLE_MAPPING=
LLM_PDF_CHAT_SIGNING_KEY=
LLM_PDF_CHAT_JWS_ALG=
LLM_PDF_CHAT_JWT_AUDIENCE=
LLM_PDF_CHAT_JWT_ISSUER=
TERMINUS_LLM_TENANT=
TERMINUS_LLM_PRODUCT=
TERMINUS_WRITE_API_KEY=
TERMINUS_READ_API_KEY=
100 changes: 80 additions & 20 deletions components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import DSyncLogo from '@components/logo/DSync';
import AuditLogsLogo from '@components/logo/AuditLogs';
import Vault from '@components/logo/Vault';
import Cog8ToothIcon from '@heroicons/react/24/outline/Cog8ToothIcon';
import { useCallback, useEffect } from 'react';
import useFeatures from '@lib/ui/hooks/useFeatures';

type SidebarProps = {
isOpen: boolean;
Expand All @@ -22,15 +24,33 @@ type MenuItem = {
href: string;
text: string;
active: boolean;
onClick?: () => void;
icon?: any;
items?: MenuItem[];
current?: boolean;
};

export const Sidebar = ({ isOpen, setIsOpen, branding }: SidebarProps) => {
const { t } = useTranslation('common');
const { asPath } = useRouter();

const menus = [
const closeSidebar = useCallback(() => setIsOpen(false), [setIsOpen]);

const features = useFeatures();

useEffect(() => {
function handleEscKey(e) {
if ((e as KeyboardEvent).key === 'Escape') {
closeSidebar();
}
}
document.addEventListener('keydown', handleEscKey);
return () => {
document.removeEventListener('keydown', handleEscKey);
};
}, [closeSidebar]);

const menuItems = [
{
href: '/admin/dashboard',
text: t('dashboard'),
Expand Down Expand Up @@ -126,6 +146,27 @@ export const Sidebar = ({ isOpen, setIsOpen, branding }: SidebarProps) => {
},
],
},
features?.llmVault
? {
href: '/admin/llm-vault/chat',
text: t('llm_vault'),
icon: Vault,
current: asPath.includes('llm-vault'),
active: asPath.includes('/admin/llm-vault'),
items: [
{
href: '/admin/llm-vault/chat',
text: t('bui-chat'),
active: asPath.includes('/admin/llm-vault/chat'),
},
{
href: '/admin/llm-vault/audit-logs',
text: t('audit_logs'),
active: asPath.includes('/admin/llm-vault/audit-logs'),
},
],
}
: null,
{
href: '/admin/settings',
text: t('settings'),
Expand All @@ -144,28 +185,30 @@ export const Sidebar = ({ isOpen, setIsOpen, branding }: SidebarProps) => {
},
],
},
];
].filter((m): m is NonNullable<typeof m> => m !== null);

const menus: MenuItem[] = menuItems;

return (
<>
{/* Sidebar for mobile */}
<div
className={classNames('relative z-40 md:hidden', { hidden: isOpen })}
className={classNames('relative z-40 md:hidden', { hidden: !isOpen })}
role='dialog'
aria-modal='true'>
<div className='fixed inset-0 bg-gray-600 bg-opacity-75' />
<div className='fixed inset-0 z-40 flex'>
<div className='relative flex w-full max-w-xs flex-1 flex-col bg-white pt-5 pb-4'>
<div className='absolute top-0 right-0 -mr-12 pt-2'>
<div className='absolute top-0 right-0 -mr-12 pt-2'></div>
<div className='flex flex-shrink-0 items-center px-4'>
<BrandingLink t={t} branding={branding}></BrandingLink>
<button
onClick={() => {
setIsOpen(!isOpen);
}}
onClick={closeSidebar}
type='button'
className='ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white'>
<span className='sr-only'>{t('close_sidebar')}</span>
<svg
className='h-6 w-6 text-white'
className='h-6 w-6'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
Expand All @@ -176,24 +219,40 @@ export const Sidebar = ({ isOpen, setIsOpen, branding }: SidebarProps) => {
</svg>
</button>
</div>
<div className='flex flex-shrink-0 items-center px-4'>
<BrandingLink t={t} branding={branding}></BrandingLink>
</div>
<div className='mt-5 h-0 flex-1 overflow-y-auto'>
<MenuItems menus={menus} />
</div>
</div>
<div className='w-14 flex-shrink-0' aria-hidden='true'></div>
<div className='w-14 flex-1' aria-hidden='true' onClick={closeSidebar}></div>
</div>
</div>

{/* Sidebar for desktop */}
<div className='hidden md:fixed md:inset-y-0 md:flex md:w-64 md:flex-col'>
<div className='flex flex-grow flex-col overflow-y-auto border-r border-gray-200 bg-white pt-5'>
<div className='flex flex-shrink-0 items-center px-4'>
<div
className={classNames('hidden w-64 flex-col flex-shrink-0 h-full', {
hidden: !isOpen,
'md:flex': isOpen,
})}>
<div className='flex flex-grow flex-col overflow-y-hidden border-r border-gray-200 bg-white pt-5 h-full'>
<div className='flex flex-shrink-0 items-center pl-4 pr-2'>
<BrandingLink t={t} branding={branding}></BrandingLink>
<button
onClick={closeSidebar}
type='button'
className='ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white'>
<span className='sr-only'>{t('close_sidebar')}</span>
<svg
className='h-6 w-6'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
strokeWidth={2}
stroke='currentColor'
aria-hidden='true'>
<path strokeLinecap='round' strokeLinejoin='round' d='M6 18L18 6M6 6l12 12' />
</svg>
</button>
</div>
<div className='mt-5 flex flex-1 flex-col'>
<div className='my-5 flex flex-1 flex-col h-full overflow-y-auto '>
<MenuItems menus={menus} />
</div>
</div>
Expand All @@ -204,11 +263,11 @@ export const Sidebar = ({ isOpen, setIsOpen, branding }: SidebarProps) => {

const MenuItems = ({ menus }: { menus: MenuItem[] }) => {
return (
<nav className='space-y-1'>
<nav className='space-y-1 h-full overflow-y-auto'>
{menus.map((menu, id) => {
return (
<div key={id}>
<ItemLink key={id} {...menu} />
<ItemLink {...menu} />
{menu.items && <SubMenuItems items={menu.items} />}
</div>
);
Expand All @@ -230,11 +289,12 @@ const SubMenuItems = ({ items }: { items: MenuItem[] }) => {
};

const ItemLink = (props: MenuItem) => {
const { href, text, active } = props;
const { href, text, active, onClick } = props;

return (
<Link
href={href}
onClick={onClick}
className={classNames(
'group mx-2 flex items-center rounded-md py-2 px-2 text-sm text-gray-900',
active ? 'bg-gray-100 font-bold' : 'font-medium hover:bg-gray-100 hover:text-gray-900'
Expand Down
60 changes: 32 additions & 28 deletions components/layouts/AccountLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const AccountLayout = ({ children }: { children: React.ReactNode }) => {
const { t } = useTranslation('common');
const { data: session, status } = useSession({ required: true });

const [isOpen, setIsOpen] = useState(false);
const [isOpen, setIsOpen] = useState(true);
const [branding, setBranding] = useState<any>(null);

useEffect(() => {
Expand Down Expand Up @@ -39,34 +39,38 @@ export const AccountLayout = ({ children }: { children: React.ReactNode }) => {
<title>{(branding ? branding.companyName : 'BoxyHQ') + ' ' + t('admin_portal')}</title>
<link rel='icon' href={branding ? branding.faviconUrl : '/favicon.ico'} />
</Head>
<Sidebar isOpen={isOpen} setIsOpen={setIsOpen} branding={branding} />
<div className='flex flex-1 flex-col md:pl-64'>
<div className='sticky top-0 z-10 flex h-16 flex-shrink-0 border-b bg-white'>
<button
onClick={() => {
setIsOpen(!isOpen);
}}
type='button'
className='border-r border-gray-200 px-4 text-gray-500 focus:outline-none focus:ring-2 focus:ring-inset md:hidden'>
<span className='sr-only'>{t('open_sidebar')}</span>
<svg
className='h-6 w-6'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
strokeWidth={2}
stroke='currentColor'
aria-hidden='true'>
<path strokeLinecap='round' strokeLinejoin='round' d='M4 6h16M4 12h16M4 18h7' />
</svg>
</button>
<Navbar session={session} />
</div>
<main>
<div className='py-6'>
<div className='mx-auto max-w-7xl px-4 sm:px-6 md:px-8'>{children}</div>
<div className='flex h-full'>
<Sidebar isOpen={isOpen} setIsOpen={setIsOpen} branding={branding} />
<div className='flex flex-1 flex-col w-[calc(100%-16rem)]'>
<div className='sticky top-0 z-10 flex h-16 flex-shrink-0 border-b bg-white'>
{!isOpen && (
<button
onClick={() => {
setIsOpen(!isOpen);
}}
type='button'
className='border-r border-gray-200 px-4 text-gray-500 focus:outline-none focus:ring-2 focus:ring-inset '>
<span className='sr-only'>{t('open_sidebar')}</span>
<svg
className='h-6 w-6'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
strokeWidth={2}
stroke='currentColor'
aria-hidden='true'>
<path strokeLinecap='round' strokeLinejoin='round' d='M4 6h16M4 12h16M4 18h7' />
</svg>
</button>
)}
<Navbar session={session} />
</div>
</main>
<main className='h-[calc(100vh-4rem)] overflow-auto'>
<div className='py-6 h-full'>
<div className='mx-auto px-4 h-full'>{children}</div>
</div>
</main>
</div>
</div>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions components/terminus/Blockly/BlocklyComponent.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.blocklyDiv {
height: calc(100% - 151px);
width: calc(100% - 256px);
width: calc(100%);
position: absolute;
top: 151px;
left: 256px;
/* left: 256px; */
}
12 changes: 10 additions & 2 deletions components/terminus/Blockly/BlocklyComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useTranslation } from 'next-i18next';
import * as Blockly from 'blockly/core';
import 'blockly/blocks';
import { maskSetup } from '@components/terminus/blocks/customblocks';
import * as locale from 'blockly/msg/en';
Blockly.setLocale(locale);
// import * as locale from 'blockly/msg/en';
// Blockly.setLocale(locale);

import { generateModel } from '@components/terminus/blocks/generator';
import { errorToast, successToast } from '@components/Toaster';
Expand Down Expand Up @@ -84,6 +84,14 @@ function BlocklyComponent(props) {
const { initialXml, ...rest } = props;
primaryWorkspace.current = Blockly.inject(blocklyDiv.current as any, {
toolbox: toolbox.current,
zoom: {
controls: true,
wheel: true,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2,
startScale: 0.8,
},
readOnly: false,
trashcan: true,
media: '/terminus/',
Expand Down
2 changes: 1 addition & 1 deletion e2e/support/fixtures/setuplink-ds-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class SetupLinkDSPage {
await expect(this.page.getByRole('table')).toBeVisible();

// Delete the created setuplink
await this.page.getByRole('button').nth(5).click();
await this.page.getByRole('button').nth(6).click();
await this.page.getByRole('button', { name: 'Delete' }).click();
}
}
2 changes: 1 addition & 1 deletion e2e/support/fixtures/setuplink-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class SetupLinkPage {
await expect(this.page.getByRole('table')).toBeVisible();

// Delete the created setuplink
await this.page.getByRole('button').nth(5).click();
await this.page.getByRole('button').nth(6).click();
await this.page.getByRole('button', { name: 'Delete' }).click();
}
}
2 changes: 1 addition & 1 deletion e2e/ui/Directory Sync/setup_link_ds.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function deleteDirectory(setupLinkPage: Page) {
await setupLinkPage.getByRole('button', { name: 'Confirm' }).click();
}

test.describe('Admin Portal Dyrectory Sync SetupLink', () => {
test.describe('Admin Portal Directory Sync SetupLink', () => {
test('should be able to create setup link and directories', async ({ page, setuplinkPage }) => {
// get setuplink url
const linkContent = await setuplinkPage.getSetupLinkUrl();
Expand Down
Loading