- Removed the owner field from InstanceProfile as it is no longer needed. - Added an initialized field to InstanceProfile to indicate if the instance has completed first-time setup. - Updated GetInstanceProfile method to set initialized based on the existence of an admin user. - Modified tests to reflect changes in InstanceProfile and ensure correct behavior regarding instance initialization. - Adjusted frontend logic to redirect users based on the initialized status instead of the owner field.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { MemoRenderContext } from "@/components/MasonryView";
|
|
import MemoView from "@/components/MemoView";
|
|
import PagedMemoList from "@/components/PagedMemoList";
|
|
import { useInstance } from "@/contexts/InstanceContext";
|
|
import { useMemoFilters, useMemoSorting } from "@/hooks";
|
|
import useCurrentUser from "@/hooks/useCurrentUser";
|
|
import { State } from "@/types/proto/api/v1/common_pb";
|
|
import { Memo } from "@/types/proto/api/v1/memo_service_pb";
|
|
|
|
const Home = () => {
|
|
const user = useCurrentUser();
|
|
const { isInitialized } = useInstance();
|
|
|
|
const memoFilter = useMemoFilters({
|
|
creatorName: user?.name,
|
|
includeShortcuts: true,
|
|
includePinned: true,
|
|
});
|
|
|
|
const { listSort, orderBy } = useMemoSorting({
|
|
pinnedFirst: true,
|
|
state: State.NORMAL,
|
|
});
|
|
|
|
return (
|
|
<div className="w-full min-h-full bg-background text-foreground">
|
|
<PagedMemoList
|
|
renderer={(memo: Memo, context?: MemoRenderContext) => (
|
|
<MemoView key={`${memo.name}-${memo.displayTime}`} memo={memo} showVisibility showPinned compact={context?.compact} />
|
|
)}
|
|
listSort={listSort}
|
|
orderBy={orderBy}
|
|
filter={memoFilter}
|
|
enabled={isInitialized && !!user} // Wait for contexts to stabilize before fetching
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Home;
|