import { Suspense } from 'react';
import { getMe } from '@/features/auth/api.server';
import { SettingsDenied } from '@/features/auth/SettingsDenied';
import { LegacyAppsView } from '@/features/settings/ui/legacy-apps/LegacyAppsView';

export const metadata = {
  title: 'Legacy Apps',
};

/**
 * Settings › Integrations › Legacy Apps: private-app tokens, live. `?app=<id>` opens an app's page,
 * `&edit=1` its Edit app page (6 Nov design: app-sync-details / app-sync-edit).
 */
export default async function SettingsLegacyAppsPage() {
  const me = await getMe();
  if (!me.permissionSet.rules.app.manage_settings) {
    return <SettingsDenied title="Legacy Apps" area="settings" />;
  }
  return (
    <Suspense>
      <LegacyAppsView />
    </Suspense>
  );
}
