Skip to content

Commit

Permalink
Merge pull request #15 from firecamp-io/fc-scrollbar
Browse files Browse the repository at this point in the history
Fc scrollbar
  • Loading branch information
Nishchit14 authored Oct 3, 2022
2 parents c7693de + b0e57d9 commit f668751
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 59 deletions.
2 changes: 1 addition & 1 deletion packages/firecamp-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@types/react-dom": "^17.0.13"
},
"dependencies": {
"@firecamp/cloud-apis": "^0.0.16",
"@firecamp/cloud-apis": "^0.0.17",
"@firecamp/cookie-manager": "^0.0.0",
"@firecamp/graphql": "^0.0.0",
"@firecamp/rest": "^0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,12 @@ const Explorer: FC<any> = () => {
onSelectItems={_onNodeSelect}
onRegisterTree={(...a) => console.log(a, 'on register tree')}
onDrop={onDrop}
// onMissingItems={(itemIds )=> console.log(itemIds, "onMissingItems")}
// onMissingChildren={(itemIds )=> console.log(itemIds, "onMissingChildren")}
onMissingItems={(itemIds )=> {
// console.log(itemIds, "onMissingItems")
}}
onMissingChildren={(itemIds )=> {
// console.log(itemIds, "onMissingChildren")
}}
>
<Tree
treeId="collections-explorer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export class WorkspaceCollectionsProvider<T = any> implements TreeDataProvider {
}

public addFolderItem(item: any) {
if (!item.meta) item.meta = { f_orders: [], r_orders: [] };
this.items.push({ ...item, _meta: { ...item._meta, is_folder: true } });
this.items.map((i) => {
if (item._meta.folder_id && i._meta.id == item._meta.folder_id) {
Expand Down Expand Up @@ -255,19 +256,42 @@ export class WorkspaceCollectionsProvider<T = any> implements TreeDataProvider {

public deleteFolderItem(itemId: string) {
const item = this.items.find((i) => i._meta.id == itemId);
if (!item) return item;
this.items = this.items.filter((i) => i._meta.id != itemId);
// TODO: remove from parent children
if (!item) return;
this.items = this.items
.filter((i) => i._meta.id != itemId)
.map((i) => {
// remove folder from parent's f_orders
if (
i._meta.id == item._meta.folder_id ||
i._meta.id == item._meta.collection_id
) {
const newFldOrders = i.meta.f_orders.filter((f) => f != itemId);
return { ...i, meta: { ...i.meta, f_orders: newFldOrders } };
}
return i;
});
this.emitter.emit(ETreeEventTypes.itemChanged, [
item._meta.folder_id || item._meta.collection_id,
]);
}

public deleteRequestItem(itemId: string) {
const item = this.items.find((i) => i._meta.id == itemId);
if (!item) return item;
this.items = this.items.filter((i) => i._meta.id != itemId);
// TODO: remove from parent children
if (!item) return;
this.items = this.items
.filter((i) => i._meta.id != itemId)
.map((i) => {
// remove folder from parent's f_orders
if (
i._meta.id == item._meta.folder_id ||
i._meta.id == item._meta.collection_id
) {
const newReqOrders = i.meta.f_orders.filter((r) => r != itemId);
return { ...i, meta: { ...i.meta, r_orders: newReqOrders } };
}
return i;
});

this.emitter.emit(ETreeEventTypes.itemChanged, [
item._meta.folder_id || item._meta.collection_id,
]);
Expand Down
52 changes: 28 additions & 24 deletions packages/firecamp-core/src/store/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ import create from 'zustand';
import { devtools } from 'zustand/middleware';
import { nanoid } from 'nanoid';
import _reject from 'lodash/reject';

import { ICollection } from '@firecamp/types';
import { _object, _string } from '@firecamp/utils';
import { Rest } from '@firecamp/cloud-apis';
import {
TId,
IWorkspace,
IOrganization,
EWorkspaceType,
} from '@firecamp/types';
import { TId, IWorkspace, EWorkspaceType } from '@firecamp/types';

import { useEnvStore } from './environment';
import AppService from '../services/app';
Expand Down Expand Up @@ -232,12 +227,13 @@ export const useWorkspaceStore = create<IWorkspaceStore>(
const res = await Rest.collection
.create(_collection)
.then((r) => {
const col: ICollection = r.data;
set((s) => {
s.explorer?.tdpInstance.addCollectionItem(_collection);
s.explorer?.tdpInstance.addCollectionItem(col);
return {
explorer: {
...s.explorer,
collections: [...s.explorer.collections, _collection],
collections: [...s.explorer.collections, col],
},
};
});
Expand Down Expand Up @@ -277,7 +273,7 @@ export const useWorkspaceStore = create<IWorkspaceStore>(
.then((r) => {
set((s) => {
const collections = s.explorer.collections.filter(
(c) => c._meta.id == cId
(c) => c._meta.id != cId
);
s.explorer.tdpInstance.deleteCollectionItem(cId);
return { explorer: { ...s.explorer, collections } };
Expand Down Expand Up @@ -307,20 +303,28 @@ export const useWorkspaceStore = create<IWorkspaceStore>(
};

state.toggleProgressBar(true);
const res = await Rest.folder.create(_folder);
state.toggleProgressBar(false);
const res = await Rest.folder
.create(_folder)
.then((res) => {
//@ts-ignore
if (_folder.meta?.type) _folder.meta.type = 'F';
set((s) => {
s.explorer?.tdpInstance.addFolderItem(_folder);
return {
explorer: {
...s.explorer,
folders: [...s.explorer.folders, _folder],
},
};
});
})
// .catch((e) => {
// console.log(e);
// })
.finally(() => {
state.toggleProgressBar(false);
});

//@ts-ignore
_folder.meta = { type: 'F' };
set((s) => {
s.explorer?.tdpInstance.addFolderItem(_folder);
return {
explorer: {
...s.explorer,
folders: [...s.explorer.folders, _folder],
},
};
});
return res;
},
updateFolder: async (fId: string, payload: { [k: string]: any }) => {
Expand Down Expand Up @@ -355,7 +359,7 @@ export const useWorkspaceStore = create<IWorkspaceStore>(
.delete(fId)
.then((r) => {
set((s) => {
const folders = s.explorer.folders.filter((f) => f._meta.id == fId);
const folders = s.explorer.folders.filter((f) => f._meta.id != fId);
s.explorer.tdpInstance.deleteFolderItem(fId);
return { explorer: { ...s.explorer, folders } };
});
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-kit/src/components/ToolBar/ToolBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

.toolbar>* {
margin-left: 2px;
padding: 2px;
padding: 1px;
cursor: pointer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const MultiLineIFE: FC<IMultiLineIFE> = ({
}

return (
<div className={classnames("relative h-full mt-4",className)}>
<div className={classnames("relative h-full",className)}>
<div className="fc-input-IFE-multiline-placeholder">
<div>{!value ? placeholder || '' : ''}</div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions packages/ui-kit/src/components/grid/Resizable.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
.fc-col-resizer.left>div:last-child:hover>div:after ,.fc-col-resizer.left>div:last-child:focus>div:after,.fc-col-resizer.left>div:last-child:active>div:after ,
.fc-col-resizer.right>div:last-child:hover>div:after ,.fc-col-resizer.right>div:last-child:focus>div:after,.fc-col-resizer.right>:last-child:active>div:after {
content: ' ';
content: " ";
position: absolute;
left: 4px;
right: 5px;
left: 2px;
top: 0px;
bottom: 0px;
background: var(--app-focus);
z-index: 99;
width: 1px;
}

.fc-col-resizer.top>div:last-child:hover>div:after ,.fc-col-resizer.top>div:last-child:focus>div:after,.fc-col-resizer.top>div:last-child:active>div:after ,
Expand Down Expand Up @@ -43,3 +45,7 @@
.fc-col-resizer>.col{
height: 100% !important;
}
.fc-col-resizer.right > div:last-child>div,.fc-col-resizer.left > div:last-child>div {
width: 6px !important;
right: -3px !important;
}
18 changes: 17 additions & 1 deletion packages/ui-kit/src/components/pane/Pane.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,23 @@
.pane-body>.rct-tree-root::-webkit-scrollbar-thumb{
background: var(--focus-level-4);
}

.pane-body .rct-tree-root
{
height: calc( 100% - 2px);
overflow: auto;
scrollbar-color: rebeccapurple green;
scrollbar-width: thin;
}
.pane-body .rct-tree-root::-webkit-scrollbar{
width: 0px;
height: 8px;
}
.pane-body:hover .rct-tree-root::-webkit-scrollbar{
width: 8px;
}
.pane-body .rct-tree-root::-webkit-scrollbar-thumb{
background: var(--focus-level-4);
}

/*------pane header css starts ---------*/
.pane-header{
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-kit/src/components/pane/Pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Header: FC<IHeader> = ({ titleRenderer, actionRenderer, actions, className

const Body: FC<IBody> = ({ children, className }) => {
return (
<div className={cx("pane-body p-2 focus-outer overflow-auto visible-scrollbar", className)} tabIndex={1}>
<div className={cx("pane-body p-2 focus-outer", className)} tabIndex={1}>
{children}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-kit/src/components/response/tabs/BodyTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const BodyTab: FC<IBodyTab> = ({ data, headers }) => {
</StatusBar.PrimaryRegion>
</StatusBar>
</Container.Header>
<Container.Body overflow={'visible'}>
<Container.Body overflow={'hidden'}>
{_renderTabBody(activeTab)}
</Container.Body>
</Container>
Expand Down
5 changes: 5 additions & 0 deletions packages/ui-kit/src/components/status-bar/StatusBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,10 @@
.fc-statusbar .fc-urlbar-path {
margin-top: 0px;
overflow: visible;
line-height: 22px;
height: 20px;
}
.fc-urlbar-path>span{
line-height: 18px;
}
/*---statusbar old css end---------------*/
11 changes: 8 additions & 3 deletions packages/ui-kit/src/components/tabs/Tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
}

.custom-scrollbar::-webkit-scrollbar{
width: 4px;
height: 4px;
width: 4px !important;
height: 4px !important;
}

.custom-scrollbar:hover::-webkit-scrollbar-thumb,.doc-explorer-contents:hover::-webkit-scrollbar-thumb
Expand All @@ -63,4 +63,9 @@
margin-bottom: -4px;
overflow-x: scroll;
overflow-y: hidden;
}
}
@-moz-document url-prefix() {
.custom-scrollbar {
padding-bottom: 4px;
}
}
1 change: 1 addition & 0 deletions packages/ui-kit/src/components/tree/tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
}
.save-modal-collection .rct-tree-root{
max-height: 200px;
overflow: auto;
}
.save-modal-collection .rct-tree-root::-webkit-scrollbar{
background: transparent;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-kit/src/components/url/components/UrlBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const UrlBar: FC<IUrlBar> & {
<div className="fc-statusbar">
{!!nodePath ? (
<div className="fc-urlbar-path">
{nodePath || ''}
<span>{nodePath || ''}</span>
<ToolBar className="ml-4 visible">
{ showEditIcon? <VscEdit size={16} onClick={onEditClick}/>: <></> }
<CopyButton className="hidden" id={`copy-button`} text={nodePath || ''} />
Expand Down
27 changes: 22 additions & 5 deletions packages/ui-kit/src/scss/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -579,19 +579,31 @@ textarea:focus,textarea:focus-visible{

/*---------scrollbar css start----------*/
.doc-explorer-contents::-webkit-scrollbar
{
width: 0px;
height: 0px;
transition: width 1s
}
.doc-explorer-contents:hover::-webkit-scrollbar
{
width: 8px;
height: 8px;
}
.doc-explorer-contents:hover::-webkit-scrollbar:hover
{
width: 12px;
height: 8px;

}
.visible-scrollbar::-webkit-scrollbar-thumb
{
background-color: var(--focus-level-4) !important;
background-color: var(--focus-level-4) !important;
}
::-webkit-scrollbar-track{
background: transparent;
}
::-webkit-scrollbar-thumb{
background: #000 !important;
background: var(--focus-level-4) !important;
border-radius: 10px;
}

Expand All @@ -612,8 +624,13 @@ background-color: var(--focus-level-4) !important;
}
.visible-scrollbar::-webkit-scrollbar, .visible-scrollbar > div::-webkit-scrollbar{
display: block;
width: 4px;
height: 4px;
width: 0px;
height: 0px;
}
.visible-scrollbar:hover::-webkit-scrollbar, .visible-scrollbar > div:hover::-webkit-scrollbar{
display: block;
width: 8px;
height: 8px;
}
.visible-scrollbar ::-webkit-scrollbar-track{
background: transparent;
Expand Down Expand Up @@ -771,4 +788,4 @@ body .ace_editor .ace_scrollbar{
color: var(--cm-ws)
}

/*---code mirror css ends----------*/
/*---code mirror css ends----------*/
Loading

0 comments on commit f668751

Please sign in to comment.