Skip to content

Commit 9a1d8f7

Browse files
committed
Sharable link in table
1 parent 09d5a90 commit 9a1d8f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+132
-93
lines changed

smoosense-gui/src/components/layout/SharePopover.tsx

Lines changed: 0 additions & 34 deletions
This file was deleted.

smoosense-gui/src/components/layout/TableNavbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { setActiveTab } from '@/lib/features/ui/uiSlice'
55
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
66
import IconDialog from '@/components/common/IconDialog'
77
import AssistantPopover from '@/lib/features/assistant/AssistantPopover'
8-
import SharePopover from './SharePopover'
8+
import TableSharePopover from './TableSharePopover'
99
import { useAIQuickActions } from '@/lib/hooks/useAIQuickActions'
1010
import { Folder } from 'lucide-react'
1111
import DebugStateViewer from '@/components/debug/DebugStateViewer'
@@ -75,7 +75,7 @@ export default function TableNavbar() {
7575
>
7676
<FolderBrowserTabContent />
7777
</IconDialog>,
78-
<SharePopover key="share" />,
78+
<TableSharePopover key="share" />,
7979
...(debugMode ? [<DebugStateViewer key="debug" />, <SqlHistoryViewer key="sql" />] : [])
8080
]
8181

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
'use client'
2+
3+
import { Share2 } from 'lucide-react'
4+
import IconPopover from '@/components/common/IconPopover'
5+
import AutoLink from '@/components/common/AutoLink'
6+
import CopyToClipboard from '@/components/ui/CopyToClipboard'
7+
import { useAppSelector } from '@/lib/hooks'
8+
import { omit, pickBy, isEmpty, isNil } from 'lodash'
9+
10+
function TableSharePopoverContent() {
11+
const uiState = useAppSelector((state) => state.ui)
12+
13+
// Construct the URL
14+
const constructShareUrl = () => {
15+
const baseUrl = window.location.origin
16+
17+
// Excluded keys
18+
const excludedKeys: Array<keyof typeof uiState> = ['baseUrl', 'sqlQuery', 'sqlResult']
19+
20+
// Filter out excluded keys and empty values
21+
const filteredState = pickBy(
22+
omit(uiState, excludedKeys),
23+
(value) => {
24+
if (isNil(value) || value === '') return false
25+
if (Array.isArray(value) && isEmpty(value)) return false
26+
return true
27+
}
28+
)
29+
30+
// Convert to URL params
31+
const params = new URLSearchParams()
32+
Object.entries(filteredState).forEach(([key, value]) => {
33+
params.set(key, String(value))
34+
})
35+
36+
const queryString = params.toString()
37+
return `${baseUrl}/Table${queryString ? `?${queryString}` : ''}`
38+
}
39+
40+
const shareUrl = constructShareUrl()
41+
42+
return (
43+
<div className="space-y-3">
44+
<h3 className="text-sm font-semibold">Share Table View</h3>
45+
<div className="space-y-2">
46+
<p className="text-xs text-muted-foreground">
47+
Share this link to open the same table with current settings:
48+
</p>
49+
<div className="flex items-center gap-2">
50+
<CopyToClipboard value={shareUrl} />
51+
<AutoLink url={shareUrl} className="flex-1" />
52+
</div>
53+
</div>
54+
</div>
55+
)
56+
}
57+
58+
export default function TableSharePopover() {
59+
return (
60+
<IconPopover
61+
icon={<Share2 />}
62+
tooltip="Share"
63+
contentClassName="w-96 p-4"
64+
align="end"
65+
>
66+
<TableSharePopoverContent />
67+
</IconPopover>
68+
)
69+
}

smoosense-gui/src/lib/features/boxplot/BoxPlot.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ ModuleRegistry.registerModules([AllCommunityModule])
1717
export default function BoxPlot() {
1818
const dispatch = useAppDispatch()
1919
const { data, loading, error } = useBoxPlot()
20-
const boxPlotColumns = useAppSelector((state) => state.ui.boxPlotColumns)
20+
const boxPlotColumnsRaw = useAppSelector((state) => state.ui.boxPlotColumns)
2121
const boxPlotSortBy = useAppSelector((state) => state.ui.boxPlotSortBy)
2222
const boxPlotBreakdownColumn = useAppSelector((state) => state.ui.boxPlotBreakdownColumn)
23-
const boxPlotSorting = useAppSelector((state) => state.ui.boxPlotSorting)
24-
23+
const boxPlotSortingRaw = useAppSelector((state) => state.ui.boxPlotSorting)
24+
25+
// Ensure stable references for array dependencies
26+
const boxPlotColumns = useMemo(() => boxPlotColumnsRaw || [], [boxPlotColumnsRaw])
27+
const boxPlotSorting = useMemo(() => boxPlotSortingRaw || [], [boxPlotSortingRaw])
28+
2529
const gridRef = useRef<AgGridReact>(null)
2630
const gridApiRef = useRef<GridApi | null>(null)
2731
const theme = useAGGridTheme()

smoosense-py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "smoosense"
3-
version = "0.1.11"
3+
version = "0.1.12"
44
description = "Smoothly make sense of your large multi-modal datasets"
55
readme = "README.md"
66
requires-python = ">=3.9"

smoosense-py/smoosense/statics/404.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

smoosense-py/smoosense/statics/DB.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

smoosense-py/smoosense/statics/DB.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
5:I[29906,[],""]
66
6:I[84526,["265","static/chunks/6dc81886-0d3828b166e5e246.js","933","static/chunks/933-3fa934a1373c1443.js","769","static/chunks/769-38a429028a9a1959.js","496","static/chunks/496-a53c4c1abd70bd14.js","785","static/chunks/785-6f7a59e8bb062840.js","177","static/chunks/app/layout-bd16ff7615f710fc.js"],"ToasterProvider"]
77
7:I[1377,[],"ClientPageRoot"]
8-
8:I[30185,["265","static/chunks/6dc81886-0d3828b166e5e246.js","652","static/chunks/4ec49466-f80a37a142905954.js","346","static/chunks/191d07e0-76e9a3be7a7ac399.js","933","static/chunks/933-3fa934a1373c1443.js","504","static/chunks/504-8d3ce4166e6afc06.js","283","static/chunks/283-55ed42cbbeebc1e9.js","496","static/chunks/496-a53c4c1abd70bd14.js","213","static/chunks/213-3bbec1abcf724313.js","73","static/chunks/app/DB/page-f21dbe5a9321129e.js"],"default"]
8+
8:I[30185,["265","static/chunks/6dc81886-0d3828b166e5e246.js","652","static/chunks/4ec49466-f80a37a142905954.js","346","static/chunks/191d07e0-76e9a3be7a7ac399.js","933","static/chunks/933-3fa934a1373c1443.js","504","static/chunks/504-4b974e9a6c86d74f.js","283","static/chunks/283-55ed42cbbeebc1e9.js","496","static/chunks/496-a53c4c1abd70bd14.js","213","static/chunks/213-3bbec1abcf724313.js","73","static/chunks/app/DB/page-df696376a8ff8004.js"],"default"]
99
b:I[94484,[],"OutletBoundary"]
1010
d:I[78892,[],"AsyncMetadataOutlet"]
1111
f:I[94484,[],"ViewportBoundary"]
@@ -14,8 +14,8 @@ f:I[94484,[],"ViewportBoundary"]
1414
14:I[29872,[],""]
1515
:HL["/_next/static/media/4cf2300e9c8272f7-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
1616
:HL["/_next/static/media/93f479601ee12b01-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
17-
:HL["/_next/static/css/ef7a483229d374d8.css","style"]
18-
0:{"P":null,"b":"g6kx3zl2FiKNlVBPhqTBx","p":"","c":["","DB"],"i":false,"f":[[["",{"children":["DB",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ef7a483229d374d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"__variable_188709 __variable_9a8899 antialiased","children":["$","$L2",null,{"attribute":"class","defaultTheme":"dark","enableSystem":true,"disableTransitionOnChange":true,"children":[["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}],["$","$L6",null,{}]]}]}]]}]]}],{"children":["DB",["$","$1","c",{"children":[null,["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L7",null,{"Component":"$8","searchParams":{},"params":{},"promises":["$@9","$@a"]}],null,["$","$Lb",null,{"children":["$Lc",["$","$Ld",null,{"promise":"$@e"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lf",null,{"children":"$L10"}],["$","meta",null,{"name":"next-size-adjust","content":""}]],["$","$L11",null,{"children":["$","div",null,{"hidden":true,"children":["$","$12",null,{"fallback":null,"children":"$L13"}]}]}]]}],false]],"m":"$undefined","G":["$14",[]],"s":false,"S":true}
17+
:HL["/_next/static/css/9a6891c384c6385b.css","style"]
18+
0:{"P":null,"b":"XoC0nX75lcWcAQ2n128xk","p":"","c":["","DB"],"i":false,"f":[[["",{"children":["DB",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/9a6891c384c6385b.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"__variable_188709 __variable_9a8899 antialiased","children":["$","$L2",null,{"attribute":"class","defaultTheme":"dark","enableSystem":true,"disableTransitionOnChange":true,"children":[["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}],["$","$L6",null,{}]]}]}]]}]]}],{"children":["DB",["$","$1","c",{"children":[null,["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L7",null,{"Component":"$8","searchParams":{},"params":{},"promises":["$@9","$@a"]}],null,["$","$Lb",null,{"children":["$Lc",["$","$Ld",null,{"promise":"$@e"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lf",null,{"children":"$L10"}],["$","meta",null,{"name":"next-size-adjust","content":""}]],["$","$L11",null,{"children":["$","div",null,{"hidden":true,"children":["$","$12",null,{"fallback":null,"children":"$L13"}]}]}]]}],false]],"m":"$undefined","G":["$14",[]],"s":false,"S":true}
1919
9:{}
2020
a:"$0:f:0:1:2:children:2:children:1:props:children:0:props:params"
2121
10:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]

0 commit comments

Comments
 (0)