diff --git a/apps/web/.env b/apps/web/.env index e024c90ecf16f7d7e6f2443dcbeedbec779e0a6a..6639126b635f4a3dfd42216c2cb8cba03c59965d 100644 --- a/apps/web/.env +++ b/apps/web/.env @@ -1,3 +1,2 @@ VITE_BACKEND_URL=https://api.graphpolaris.com -VITE_STAGING=local -VITE_GRAPHPOLARIS_VERSION=dev-build \ No newline at end of file +VITE_STAGING=local \ No newline at end of file diff --git a/apps/web/.env.development b/apps/web/.env.development index d13895bd98bbe37c46ade0801187dff6b4feb9c5..ae8b069cf2c08ba17439ff02331a1cd821f24f10 100644 --- a/apps/web/.env.development +++ b/apps/web/.env.development @@ -5,4 +5,3 @@ VITE_SKIP_LOGIN=true VITE_BACKEND_USER=:3000 VITE_BACKEND_QUERY=:3003 VITE_BACKEND_SCHEMA=:3002 -VITE_GRAPHPOLARIS_VERSION=dev-build diff --git a/apps/web/.env.production b/apps/web/.env.production index 4127ac68bcf7c0b7d82c8d766c708e44cc3165f4..af3e58d1c908dedc543afe43a056eb55fdc800a6 100644 --- a/apps/web/.env.production +++ b/apps/web/.env.production @@ -6,5 +6,4 @@ VITE_SKIP_LOGIN=false VITE_BACKEND_USER=/user VITE_BACKEND_QUERY=/query VITE_BACKEND_SCHEMA=/schema -GRAPHPOLARIS_VERSION=prod-build diff --git a/apps/web/src/components/navbar/navbar.tsx b/apps/web/src/components/navbar/navbar.tsx index aca99f1eefbee644071e3a048e5745d71d71edc3..4dcd98d87694991420891c42d102e259c2411e33 100644 --- a/apps/web/src/components/navbar/navbar.tsx +++ b/apps/web/src/components/navbar/navbar.tsx @@ -69,6 +69,8 @@ export const Navbar = (props: NavbarComponentProps) => { const currentLogo = !'dark' ? logo_white : logo; // TODO: support dark mode + const buildInfo = import.meta.env.VITE_GRAPHPOLAIRS_VERSION || 'dev'; + return ( <div className="w-full h-auto px-5"> <NewDatabaseForm open={addDatabaseFormOpen} onClose={() => setAddDatabaseFormOpen(false)} /> @@ -163,7 +165,7 @@ export const Navbar = (props: NavbarComponentProps) => { </li> <div className="menu-title"> <div className="absolute left-0 h-0.5 w-full bg-offwhite-300"></div> - <h3 className="text-xs mt-3">Version: {import.meta.env.VITE_GRAPHPOLARIS_VERSION}</h3> + <h3 className="text-xs mt-3">Version: {buildInfo}</h3> </div> </> ) : ( @@ -185,7 +187,7 @@ export const Navbar = (props: NavbarComponentProps) => { </div> <div className="menu-title"> <div className="absolute left-0 h-0.5 w-full bg-offwhite-300"></div> - <h3 className="text-xs mt-3">Version: {import.meta.env.VITE_GRAPHPOLARIS_VERSION}</h3> + <h3 className="text-xs mt-3">Version: {buildInfo}</h3> </div> </> )} diff --git a/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss b/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss index e722685457e59d97528adcc87523e3f609d74735..df212f7f699a6e6787fa338c63b3a3286f8a767f 100644 --- a/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss +++ b/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss @@ -1,99 +1 @@ @import '../../querypills.module.scss'; - -.highlighted { - box-shadow: black 0 0 2px; -} - -.react-flow__edge-default .selected { - stroke: gray !important; -} - -.contentWrapper { - margin-left: 3ch; - - span { - max-width: 20ch; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - display: block; - } -} - -// Entity element -.entity { - border-left: 3px solid; - @apply bg-entity-50; - @apply border-l-entity-600; - font-weight: bold; - min-width: 8rem; - font-size: 13px; - - .title { - position: relative; - border-top-left-radius: inherit; - border-top-right-radius: inherit; - padding: 0.2rem 1.2rem; - text-align: center; - flex-grow: 1; - background-color: '#eee'; - } - - @keyframes slide-down { - 0% { - max-height: 0px; - opacity: 0; - transform: translateY(0%); - } - 100% { - max-height: 100000px; - opacity: 1; - transform: translateY(0); - } - } - - .content { - padding: 0.2rem 1.2rem; - // visibility: hidden; - display: none; - animation: slide-down 0.2s ease-out; - overflow: hidden; - max-height: 0; - font-weight: normal; - // border-left: 1px solid; - // @apply bg-entity-50; - // @apply border-l-entity-800; - // @apply bg-base-100; - } - - .content_display { - // visibility: visible; - display: block; - max-height: unset; - } - - .io { - top: auto; - transform: translate(0, -115%); - } - .io_right { - right: 0.5rem; - } -} - -.entityFade { - opacity: 1; - animation-iteration-count: 1; - animation: fade-id, 600ms, cubic-bezier(0.4, 0, 1, 1); - @keyframes fade-id { - 0% { - opacity: 0; - } - 40% { - opacity: 0; - } - 100% { - opacity: 1; - } - } -} diff --git a/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss.d.ts b/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss.d.ts index e37860555e977a33004154e95938b792b0edaf16..e478e565f42129a12498bfde643731c7c978d6fc 100644 --- a/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss.d.ts +++ b/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.module.scss.d.ts @@ -9,8 +9,6 @@ declare const classNames: { readonly handle_logic_float: 'handle_logic_float'; readonly handle_logic_int: 'handle_logic_int'; readonly handle_logic_string: 'handle_logic_string'; - readonly handle_from_relation: 'handle_from_relation'; - readonly handle_to_relation: 'handle_to_relation'; readonly 'react-flow__node': 'react-flow__node'; readonly selected: 'selected'; readonly entityWrapper: 'entityWrapper'; @@ -21,14 +19,5 @@ declare const classNames: { readonly handleConnectedBorderRight: 'handleConnectedBorderRight'; readonly handleConnectedBorderLeft: 'handleConnectedBorderLeft'; readonly handleFunction: 'handleFunction'; - readonly highlighted: 'highlighted'; - readonly contentWrapper: 'contentWrapper'; - readonly entity: 'entity'; - readonly title: 'title'; - readonly content: 'content'; - readonly content_display: 'content_display'; - readonly io: 'io'; - readonly io_right: 'io_right'; - readonly entityFade: 'entityFade'; }; export = classNames; diff --git a/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.tsx b/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.tsx index c8391055c504fad796313813d47572f14d5b6958..f92ddde07e2424c69a4abffd79e8042dae769c8b 100644 --- a/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.tsx +++ b/libs/shared/lib/querybuilder/pills/customFlowPills/entitypill/entitypill.tsx @@ -47,52 +47,69 @@ export const EntityFlowElement = React.memo((node: SchemaReactflowEntityNode) => console.log('EntityPill onConnect', params); }; - const showingDropdown = hovered || handleBeingDragged !== -1 || attributeEdges.length > 0; + const showingDropdown = hovered || handleBeingDragged !== -1 || attributeEdges.length > 0 || forceOpen; + + const dropDown = useMemo(() => { + if (!data?.attributes) return null; + return data.attributes + .filter( + (attribute, i) => + forceOpen || + hovered || + handleBeingDragged === i || + (attributeEdges.some( + (edge) => + edge?.attributes?.sourceHandleData && + toHandleId(edge?.attributes?.sourceHandleData) === handleDataFromReactflowToId(node, attribute) + ) && + !!attribute.handleData.attributeName) + ) + .map((attribute, i) => ( + <div + className="px-5 py-1 font-semibold" + key={(attribute.handleData.attributeName || '') + i} + onMouseDown={(event: React.MouseEvent) => { + onHandleMouseDown(attribute, i, event); + }} + > + {attribute.handleData.attributeName} + <Handle + id={handleDataFromReactflowToId(node, attribute)} + type="source" + position={Position.Right} + className={ + styles.handle + + ' ' + + (attribute.handleData.attributeType ? styleHandleMap[attribute.handleData.attributeType] : '') + + ' !top-auto !-translate-y-[115%] !right-[1.2rem]' + } + ></Handle> + </div> + )); + }, [data.attributes, hovered, handleBeingDragged, attributeEdges]); return ( - <div className={`${styles.entity} ${styles.entityFade} query_builder-entity`} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}> - <Handle id={toHandleId(data.leftRelationHandleId)} type="target" position={Position.Left} className={styles.handle_from_relation} /> - <Handle id={toHandleId(data.rightRelationHandleId)} type="source" position={Position.Right} className={styles.handle_to_relation} /> - <div className={styles.title}>{data.name}</div> - {data?.attributes && ( - <div className={styles.content + ' ' + (showingDropdown || forceOpen || hovered ? styles.content_display : '')}> - {data.attributes - .filter( - (attribute, i) => - forceOpen || - hovered || - handleBeingDragged === i || - (attributeEdges.some( - (edge) => - edge?.attributes?.sourceHandleData && - toHandleId(edge?.attributes?.sourceHandleData) === handleDataFromReactflowToId(node, attribute) - ) && - !!attribute.handleData.attributeName) - ) - .map((attribute, i) => ( - <div - key={(attribute.handleData.attributeName || '') + i} - onMouseDown={(event: React.MouseEvent) => { - onHandleMouseDown(attribute, i, event); - }} - > - {attribute.handleData.attributeName} - <Handle - id={handleDataFromReactflowToId(node, attribute)} - type="source" - position={Position.Right} - className={ - (attribute.handleData.attributeType ? styleHandleMap[attribute.handleData.attributeType] : '') + - ' ' + - styles.io + - ' ' + - styles.io_right - } - ></Handle> - </div> - ))} + <div className="p-3 bg-transparent" onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}> + <div className={`border-l-[3px] border-solid bg-entity-50 border-l-entity-600 font-bold text-xs min-w-[8rem] query_builder-entity`}> + <div> + <Handle + id={toHandleId(data.leftRelationHandleId)} + type="target" + position={Position.Left} + className={styles.handle + ' !top-6 !left-2 !bg-entity-800 !rounded-none'} + /> + <Handle + id={toHandleId(data.rightRelationHandleId)} + type="source" + position={Position.Right} + className={styles.handle + ' !top-6 !right-2 !bg-entity-800 !rounded-none'} + /> + <div className="text-center py-1">{data.name}</div> </div> - )} + {data?.attributes && showingDropdown && ( + <div className={'collapse-content ' + showingDropdown ? 'animate-openmenu ' : 'animate-closemenu '}>{dropDown}</div> + )} + </div> </div> ); }); diff --git a/libs/shared/lib/querybuilder/pills/customFlowPills/logicpill/logicpill.module.scss.d.ts b/libs/shared/lib/querybuilder/pills/customFlowPills/logicpill/logicpill.module.scss.d.ts index e9035be6b5988e743701756da48324f393148bad..1ed06c620d31f89809aa11045aadeadf0895020a 100644 --- a/libs/shared/lib/querybuilder/pills/customFlowPills/logicpill/logicpill.module.scss.d.ts +++ b/libs/shared/lib/querybuilder/pills/customFlowPills/logicpill/logicpill.module.scss.d.ts @@ -9,8 +9,6 @@ declare const classNames: { readonly handle_logic_float: 'handle_logic_float'; readonly handle_logic_int: 'handle_logic_int'; readonly handle_logic_string: 'handle_logic_string'; - readonly handle_from_relation: 'handle_from_relation'; - readonly handle_to_relation: 'handle_to_relation'; readonly 'react-flow__node': 'react-flow__node'; readonly selected: 'selected'; readonly entityWrapper: 'entityWrapper'; diff --git a/libs/shared/lib/querybuilder/pills/customFlowPills/relationpill/relationpill.module.scss.d.ts b/libs/shared/lib/querybuilder/pills/customFlowPills/relationpill/relationpill.module.scss.d.ts index 55a3ce3a826e9c53c3143e7acdfd95a2043966fa..432ea72c9fc83e70e90bce2dbca2911362df4a5a 100644 --- a/libs/shared/lib/querybuilder/pills/customFlowPills/relationpill/relationpill.module.scss.d.ts +++ b/libs/shared/lib/querybuilder/pills/customFlowPills/relationpill/relationpill.module.scss.d.ts @@ -9,8 +9,6 @@ declare const classNames: { readonly handle_logic_float: 'handle_logic_float'; readonly handle_logic_int: 'handle_logic_int'; readonly handle_logic_string: 'handle_logic_string'; - readonly handle_from_relation: 'handle_from_relation'; - readonly handle_to_relation: 'handle_to_relation'; readonly 'react-flow__node': 'react-flow__node'; readonly selected: 'selected'; readonly entityWrapper: 'entityWrapper'; diff --git a/libs/shared/lib/querybuilder/pills/handles.module.scss b/libs/shared/lib/querybuilder/pills/handles.module.scss index aa9f290050aa3d1f30e0f0480bb2a129f13a2e7a..4ee3f0b4b92857f0d50d794ab196bf76bff99082 100644 --- a/libs/shared/lib/querybuilder/pills/handles.module.scss +++ b/libs/shared/lib/querybuilder/pills/handles.module.scss @@ -4,20 +4,6 @@ width: 8px !important; } -.handle_to_relation { - @extend .handle; - border-radius: 1px !important; - top: 0.75rem !important; - @apply bg-entity-800 #{!important}; //css-ignore -} - -.handle_from_relation { - @extend .handle; - border-radius: 1px !important; - top: 0.75rem !important; - @apply bg-entity-800 #{!important}; //css-ignore -} - .handle_logic { @extend .handle; diff --git a/libs/shared/lib/querybuilder/pills/handles.module.scss.d.ts b/libs/shared/lib/querybuilder/pills/handles.module.scss.d.ts index 78139bdb5cad3c36e21c153c62434318951ba1a9..59638411a050da4c9d838c6824358ea2388adfe4 100644 --- a/libs/shared/lib/querybuilder/pills/handles.module.scss.d.ts +++ b/libs/shared/lib/querybuilder/pills/handles.module.scss.d.ts @@ -9,7 +9,5 @@ declare const classNames: { readonly handle_logic_float: 'handle_logic_float'; readonly handle_logic_int: 'handle_logic_int'; readonly handle_logic_string: 'handle_logic_string'; - readonly handle_from_relation: 'handle_from_relation'; - readonly handle_to_relation: 'handle_to_relation'; }; export = classNames; diff --git a/libs/shared/lib/querybuilder/pills/querypills.module.scss.d.ts b/libs/shared/lib/querybuilder/pills/querypills.module.scss.d.ts index 442165543de553140846bfb988cee8cec92642e3..e478e565f42129a12498bfde643731c7c978d6fc 100644 --- a/libs/shared/lib/querybuilder/pills/querypills.module.scss.d.ts +++ b/libs/shared/lib/querybuilder/pills/querypills.module.scss.d.ts @@ -9,8 +9,6 @@ declare const classNames: { readonly handle_logic_float: 'handle_logic_float'; readonly handle_logic_int: 'handle_logic_int'; readonly handle_logic_string: 'handle_logic_string'; - readonly handle_from_relation: 'handle_from_relation'; - readonly handle_to_relation: 'handle_to_relation'; readonly 'react-flow__node': 'react-flow__node'; readonly selected: 'selected'; readonly entityWrapper: 'entityWrapper';