-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: manage widgets integrations #6331
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
Changes from all commits
15ff3ee
ae89bed
8b43497
1c020f0
c2412bb
2254d50
a031765
0d564e6
0263021
bba8436
99d9702
ff29170
fb9c364
5a1c521
314f714
afa330e
94a9b00
92607d2
cbfb4ec
e9cd538
062d2fe
8ae0503
4bea812
de02303
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,18 +12,20 @@ import { DashboardQuickLinks } from "./widgets/links"; | |
| import { ManageWidgetsModal } from "./widgets/manage"; | ||
|
|
||
| const WIDGETS_LIST: { | ||
| [key in THomeWidgetKeys]: { component: React.FC<THomeWidgetProps>; fullWidth: boolean }; | ||
| [key in THomeWidgetKeys]: { component: React.FC<THomeWidgetProps> | null; fullWidth: boolean }; | ||
| } = { | ||
| quick_links: { component: DashboardQuickLinks, fullWidth: false }, | ||
| recent_activity: { component: RecentActivityWidget, fullWidth: false }, | ||
| stickies: { component: StickiesWidget, fullWidth: false }, | ||
| recents: { component: RecentActivityWidget, fullWidth: false }, | ||
| my_stickies: { component: StickiesWidget, fullWidth: false }, | ||
| new_at_plane: { component: null, fullWidth: false }, | ||
| quick_tutorial: { component: null, fullWidth: false }, | ||
|
Comment on lines
+15
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirm unified widget keys usage. Defining |
||
| }; | ||
|
|
||
| export const DashboardWidgets = observer(() => { | ||
| // router | ||
| const { workspaceSlug } = useParams(); | ||
| // store hooks | ||
| const { toggleWidgetSettings, showWidgetSettings } = useHome(); | ||
| const { toggleWidgetSettings, widgetsMap, showWidgetSettings, orderedWidgets } = useHome(); | ||
|
|
||
| if (!workspaceSlug) return null; | ||
|
|
||
|
|
@@ -36,9 +38,11 @@ export const DashboardWidgets = observer(() => { | |
| handleOnClose={() => toggleWidgetSettings(false)} | ||
| /> | ||
|
|
||
| {Object.entries(WIDGETS_LIST).map(([key, widget]) => { | ||
| const WidgetComponent = widget.component; | ||
| if (widget.fullWidth) | ||
| {orderedWidgets.map((key) => { | ||
| const WidgetComponent = WIDGETS_LIST[key]?.component; | ||
| const isEnabled = widgetsMap[key]?.is_enabled; | ||
| if (!WidgetComponent || !isEnabled) return null; | ||
| if (WIDGETS_LIST[key]?.fullWidth) | ||
| return ( | ||
| <div key={key} className="lg:col-span-2"> | ||
| <WidgetComponent workspaceSlug={workspaceSlug.toString()} /> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| // components | ||
| import { RecentActivityWidgetLoader } from "./recent-activity"; | ||
| import { QuickLinksWidgetLoader } from "./quick-links"; | ||
| import { RecentActivityWidgetLoader } from "./recent-activity"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential mismatch between widget keys. You are importing |
||
|
|
||
| // types | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure consistent naming for the recent activity widget.
Here, you define
"recents"as part ofTHomeWidgetKeys. However, inloader.tsx, the enum uses"recent_activity". Please unify the naming (e.g., use all"recents"or all"recent_activity") to avoid potential type mismatches.