mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-21 18:55:16 +02:00
feat(announcements): rename "Announcements" to "What's New" across the application; add AnnouncementsDialog component for displaying updates; update empty state messaging; remove unused AnnouncementsSidebar component.
This commit is contained in:
parent
3cdfe8b5b6
commit
a9192beae3
16 changed files with 189 additions and 160 deletions
|
|
@ -8,6 +8,7 @@ import {
|
|||
Info,
|
||||
Languages,
|
||||
LogOut,
|
||||
Megaphone,
|
||||
Monitor,
|
||||
Moon,
|
||||
Sun,
|
||||
|
|
@ -60,12 +61,22 @@ const LEARN_MORE_LINKS = [
|
|||
interface SidebarUserProfileProps {
|
||||
user: User;
|
||||
onUserSettings?: () => void;
|
||||
onAnnouncements?: () => void;
|
||||
announcementUnreadCount?: number;
|
||||
onLogout?: () => void;
|
||||
isCollapsed?: boolean;
|
||||
theme?: string;
|
||||
setTheme?: (theme: "light" | "dark" | "system") => void;
|
||||
}
|
||||
|
||||
function formatAnnouncementCount(count: number): string {
|
||||
if (count <= 999) {
|
||||
return count.toString();
|
||||
}
|
||||
const thousands = Math.floor(count / 1000);
|
||||
return `${thousands}k+`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a consistent color based on email
|
||||
*/
|
||||
|
|
@ -152,6 +163,8 @@ function UserAvatar({
|
|||
export function SidebarUserProfile({
|
||||
user,
|
||||
onUserSettings,
|
||||
onAnnouncements,
|
||||
announcementUnreadCount = 0,
|
||||
onLogout,
|
||||
isCollapsed = false,
|
||||
theme,
|
||||
|
|
@ -228,6 +241,18 @@ export function SidebarUserProfile({
|
|||
{t("user_settings")}
|
||||
</DropdownMenuItem>
|
||||
|
||||
{onAnnouncements && (
|
||||
<DropdownMenuItem onClick={onAnnouncements}>
|
||||
<Megaphone className="h-4 w-4" />
|
||||
<span className="flex-1">What's New</span>
|
||||
{announcementUnreadCount > 0 && (
|
||||
<span className="inline-flex items-center justify-center min-w-4 h-4 px-1 rounded-full bg-red-500 text-white text-[10px] font-medium">
|
||||
{formatAnnouncementCount(announcementUnreadCount)}
|
||||
</span>
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
|
||||
{setTheme && (
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger>
|
||||
|
|
@ -382,6 +407,18 @@ export function SidebarUserProfile({
|
|||
{t("user_settings")}
|
||||
</DropdownMenuItem>
|
||||
|
||||
{onAnnouncements && (
|
||||
<DropdownMenuItem onClick={onAnnouncements}>
|
||||
<Megaphone className="h-4 w-4" />
|
||||
<span className="flex-1">What's New</span>
|
||||
{announcementUnreadCount > 0 && (
|
||||
<span className="inline-flex items-center justify-center min-w-4 h-4 px-1 rounded-full bg-red-500 text-white text-[10px] font-medium">
|
||||
{formatAnnouncementCount(announcementUnreadCount)}
|
||||
</span>
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
|
||||
{setTheme && (
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue