import { If } from '@kit/ui/if';

import { AppLogo } from '~/components/app-logo';
import { ProfileAccountDropdownContainer } from '~/components/personal-account-dropdown-container';
import featuresFlagConfig from '~/config/feature-flags.config';

// home imports
import { HomeAccountSelector } from '../_components/home-account-selector';
import { UserNotifications } from '../_components/user-notifications';
import { type UserWorkspace } from '../_lib/server/load-user-workspace';

export function HomeMenuNavigation(props: { workspace: UserWorkspace }) {
  const { workspace, user, accounts } = props.workspace;

  return (
    <div className={'flex w-full flex-1 justify-between'}>
      <div className={'flex items-center space-x-8'}>
        <AppLogo />

      </div>

      <div className={'flex justify-end space-x-2.5'}>
        <UserNotifications userId={user.id} />

        <If condition={featuresFlagConfig.enableTeamAccounts && accounts.length}>
          <HomeAccountSelector userId={user.id} accounts={accounts} />
        </If>

        <div>
          <ProfileAccountDropdownContainer
            user={user}
            account={workspace}
            showProfileName={false}
          />
        </div>
      </div>
    </div>
  );
}
