diff --git a/b0esche_cloud/lib/blocs/organization/organization_bloc.dart b/b0esche_cloud/lib/blocs/organization/organization_bloc.dart index 6fd992e..c5b6b6c 100644 --- a/b0esche_cloud/lib/blocs/organization/organization_bloc.dart +++ b/b0esche_cloud/lib/blocs/organization/organization_bloc.dart @@ -74,7 +74,7 @@ class OrganizationBloc extends Bloc { final currentState = state; if (currentState is OrganizationLoaded) { Organization? selected; - + if (event.orgId.isEmpty) { // Personal workspace - set to null to indicate no org selected selected = null; @@ -84,7 +84,7 @@ class OrganizationBloc extends Bloc { orElse: () => currentState.selectedOrg!, ); } - + emit( OrganizationLoaded( organizations: currentState.organizations, diff --git a/b0esche_cloud/lib/pages/home_page.dart b/b0esche_cloud/lib/pages/home_page.dart index 51df23e..9a157f8 100644 --- a/b0esche_cloud/lib/pages/home_page.dart +++ b/b0esche_cloud/lib/pages/home_page.dart @@ -192,15 +192,11 @@ class _HomePageState extends State with TickerProviderStateMixin { Row( children: [ // Personal workspace button (always show when logged in) - _buildOrgButton( - Organization(id: '', name: 'Personal'), - selectedOrg == null, - () { - context.read().add( - SelectOrganization(''), - ); - }, - ), + _buildPersonalButton(selectedOrg == null, () { + context.read().add( + SelectOrganization(''), + ); + }), const SizedBox(width: 16), // Organization tabs ...orgs.map( @@ -252,6 +248,21 @@ class _HomePageState extends State with TickerProviderStateMixin { ); } + Widget _buildPersonalButton(bool selected, VoidCallback onTap) { + final highlightColor = const Color.fromARGB(255, 100, 200, 255); + final defaultColor = AppTheme.secondaryText; + return TextButton( + onPressed: onTap, + child: Text( + 'Personal', + style: TextStyle( + color: selected ? highlightColor : defaultColor, + fontWeight: selected ? FontWeight.bold : FontWeight.normal, + ), + ), + ); + } + Widget _buildAddButton(VoidCallback onTap) { final defaultColor = AppTheme.secondaryText; return TextButton( diff --git a/b0esche_cloud/lib/services/api_client.dart b/b0esche_cloud/lib/services/api_client.dart index ff135b9..a271b65 100644 --- a/b0esche_cloud/lib/services/api_client.dart +++ b/b0esche_cloud/lib/services/api_client.dart @@ -123,14 +123,14 @@ class ApiClient { // Only try to extract code/message if data is a Map String code = 'UNKNOWN'; String message = 'Unknown error'; - + if (data is Map) { code = data['code'] ?? 'UNKNOWN'; message = data['message'] ?? 'Unknown error'; } else if (data != null) { message = data.toString(); } - + return ApiError(code: code, message: message, status: status); } }