new features

This commit is contained in:
Matthias Hochmeister
2026-03-23 18:08:49 +01:00
parent e720c52896
commit 202a658b8d
4 changed files with 28 additions and 11 deletions

View File

@@ -79,7 +79,9 @@ const BookStackRecentWidget: React.FC = () => {
const configured = data?.configured ?? false;
const pages = (data?.data ?? []).slice(0, 5);
if (!configured) {
// Only show "nicht eingerichtet" when we got a successful response with configured=false
// (not when the request errored out with 403 etc.)
if (data && !configured) {
return (
<Card sx={{ height: '100%' }}>
<CardContent>

View File

@@ -75,7 +75,7 @@ const BookStackSearchWidget: React.FC = () => {
return () => { isMountedRef.current = false; };
}, []);
const { data, isLoading: configLoading } = useQuery({
const { data, isLoading: configLoading, isError: configError } = useQuery({
queryKey: ['bookstack-recent'],
queryFn: () => bookstackApi.getRecent(),
refetchInterval: 5 * 60 * 1000,
@@ -83,7 +83,8 @@ const BookStackSearchWidget: React.FC = () => {
});
// undefined while loading, true/false once known
const configured = configLoading ? undefined : (data?.configured ?? false);
// On error (e.g. 403), treat as configured to avoid "nicht eingerichtet" message
const configured = configLoading ? undefined : configError ? true : (data?.configured ?? false);
useEffect(() => {
if (debounceRef.current) clearTimeout(debounceRef.current);

View File

@@ -187,7 +187,7 @@ function Dashboard() {
{/* Dienste Group */}
<WidgetGroup title="Dienste" gridColumn="1 / -1">
{hasPermission('wissen:widget_recent') && widgetVisible('bookstackRecent') && (
{hasPermission('wissen:view') && widgetVisible('bookstackRecent') && (
<Fade in={!dataLoading} timeout={600} style={{ transitionDelay: '600ms' }}>
<Box>
<BookStackRecentWidget />
@@ -195,7 +195,7 @@ function Dashboard() {
</Fade>
)}
{hasPermission('wissen:widget_search') && widgetVisible('bookstackSearch') && (
{hasPermission('wissen:view') && widgetVisible('bookstackSearch') && (
<Fade in={!dataLoading} timeout={600} style={{ transitionDelay: '640ms' }}>
<Box>
<BookStackSearchWidget />