@@ -14,7 +14,6 @@ import {
1414} from '../utils/file-utils.js' ;
1515import { DialogManager } from '../utils/DialogManager.js' ;
1616import { thumbnailService } from '../services/thumbnail-service.js' ;
17- import { aetherApiService } from '../services/aether-api-service.js' ;
1817import { SPACING , GRID } from '../constants/ui-constants.js' ;
1918
2019/**
@@ -81,13 +80,6 @@ export const BlueprintManagerWindow = GObject.registerClass(
8180 importButton . connect ( 'clicked' , ( ) => this . _importBlueprint ( ) ) ;
8281 headerBar . pack_end ( importButton ) ;
8382
84- const apiKeyButton = new Gtk . Button ( {
85- icon_name : 'network-server-symbolic' ,
86- tooltip_text : 'Community API Settings' ,
87- } ) ;
88- apiKeyButton . connect ( 'clicked' , ( ) => this . _showApiKeyDialog ( ) ) ;
89- headerBar . pack_end ( apiKeyButton ) ;
90-
9183 const refreshButton = new Gtk . Button ( {
9284 icon_name : 'view-refresh-symbolic' ,
9385 tooltip_text : 'Refresh' ,
@@ -422,9 +414,6 @@ export const BlueprintManagerWindow = GObject.registerClass(
422414
423415 const menu = Gio . Menu . new ( ) ;
424416 menu . append ( 'Export' , 'blueprint.export' ) ;
425- if ( aetherApiService . hasApiKey ( ) ) {
426- menu . append ( 'Post to Community' , 'blueprint.post' ) ;
427- }
428417 menu . append ( 'Delete' , 'blueprint.delete' ) ;
429418 menuButton . set_menu_model ( menu ) ;
430419
@@ -436,12 +425,6 @@ export const BlueprintManagerWindow = GObject.registerClass(
436425 ) ;
437426 actionGroup . add_action ( exportAction ) ;
438427
439- const postAction = Gio . SimpleAction . new ( 'post' , null ) ;
440- postAction . connect ( 'activate' , ( ) =>
441- this . _postToCommunity ( blueprint )
442- ) ;
443- actionGroup . add_action ( postAction ) ;
444-
445428 const deleteAction = Gio . SimpleAction . new ( 'delete' , null ) ;
446429 deleteAction . connect ( 'activate' , ( ) =>
447430 this . _deleteBlueprint ( blueprint )
@@ -553,151 +536,6 @@ export const BlueprintManagerWindow = GObject.registerClass(
553536 }
554537 }
555538
556- /**
557- * Show dialog to configure Aether Community API key
558- * @private
559- */
560- _showApiKeyDialog ( ) {
561- const currentKey = aetherApiService . getApiKey ( ) ;
562- const dialog = new Adw . MessageDialog ( {
563- heading : 'Aether Community API Key' ,
564- body : 'Enter your API key to post blueprints to https://aethr.no/\n\nYou can get an API key from your account settings on the website.' ,
565- transient_for : this . get_root ( ) ,
566- } ) ;
567-
568- dialog . add_response ( 'cancel' , 'Cancel' ) ;
569- dialog . add_response ( 'save' , 'Save' ) ;
570- dialog . set_response_appearance (
571- 'save' ,
572- Adw . ResponseAppearance . SUGGESTED
573- ) ;
574-
575- const entry = new Gtk . Entry ( {
576- placeholder_text : 'sk_live_...' ,
577- text : currentKey ,
578- margin_start : 12 ,
579- margin_end : 12 ,
580- margin_top : 6 ,
581- margin_bottom : 6 ,
582- } ) ;
583-
584- dialog . set_extra_child ( entry ) ;
585-
586- dialog . connect ( 'response' , ( _ , response ) => {
587- if ( response === 'save' ) {
588- const apiKey = entry . get_text ( ) . trim ( ) ;
589- aetherApiService . setApiKey ( apiKey ) ;
590-
591- // Refresh UI to show/hide "Post to Community" options
592- this . _updateUI ( ) ;
593-
594- const dm = new DialogManager ( this . get_root ( ) ) ;
595- if ( apiKey ) {
596- dm . showMessage ( {
597- heading : 'API Key Saved' ,
598- body : 'Your API key has been saved. You can now post blueprints to the community.' ,
599- } ) ;
600- } else {
601- dm . showMessage ( {
602- heading : 'API Key Removed' ,
603- body : 'Your API key has been removed.' ,
604- } ) ;
605- }
606- }
607- } ) ;
608-
609- dialog . present ( ) ;
610- }
611-
612- /**
613- * Post a blueprint to the Aether community as a draft
614- * @param {Object } blueprint - The blueprint to post
615- * @private
616- */
617- async _postToCommunity ( blueprint ) {
618- if ( ! aetherApiService . hasApiKey ( ) ) {
619- const dm = new DialogManager ( this . get_root ( ) ) ;
620- dm . showMessage ( {
621- heading : 'API Key Required' ,
622- body : 'Please configure your API key first using the server icon in the header.' ,
623- } ) ;
624- return ;
625- }
626-
627- // Show confirmation dialog
628- const dialogManager = new DialogManager ( this . get_root ( ) ) ;
629- dialogManager . showConfirmation ( {
630- heading : 'Post to Community' ,
631- body : `Post "${ blueprint . name } " to the Aether community as a draft?\n\nYou can publish it from the website when ready.` ,
632- confirmText : 'Post' ,
633- cancelText : 'Cancel' ,
634- onConfirm : async ( ) => {
635- // Create and show spinner dialog
636- const spinnerDialog = new Adw . MessageDialog ( {
637- heading : 'Uploading...' ,
638- body : `Posting "${ blueprint . name } " to the community` ,
639- transient_for : this . get_root ( ) ,
640- close_response : '' ,
641- } ) ;
642-
643- const spinnerBox = new Gtk . Box ( {
644- orientation : Gtk . Orientation . VERTICAL ,
645- spacing : SPACING . MD ,
646- margin_start : 24 ,
647- margin_end : 24 ,
648- margin_top : SPACING . MD ,
649- margin_bottom : SPACING . MD ,
650- halign : Gtk . Align . CENTER ,
651- } ) ;
652-
653- const spinner = new Gtk . Spinner ( {
654- spinning : true ,
655- width_request : 32 ,
656- height_request : 32 ,
657- } ) ;
658- spinnerBox . append ( spinner ) ;
659-
660- spinnerDialog . set_extra_child ( spinnerBox ) ;
661- spinnerDialog . present ( ) ;
662-
663- try {
664- const result =
665- await aetherApiService . postBlueprint ( blueprint ) ;
666-
667- // Close spinner dialog
668- spinnerDialog . close ( ) ;
669-
670- const dm = new DialogManager ( this . get_root ( ) ) ;
671-
672- if ( result . success ) {
673- dm . showMessage ( {
674- heading : 'Blueprint Posted' ,
675- body : `"${ blueprint . name } " has been posted as a draft.\n\nVisit https://aethr.no/ to publish it.` ,
676- } ) ;
677- } else {
678- dm . showMessage ( {
679- heading : 'Post Failed' ,
680- body :
681- result . message ||
682- 'Failed to post blueprint' ,
683- } ) ;
684- }
685- } catch ( e ) {
686- // Close spinner dialog
687- spinnerDialog . close ( ) ;
688-
689- console . error ( 'Error posting blueprint:' , e . message ) ;
690- const dm = new DialogManager ( this . get_root ( ) ) ;
691- dm . showMessage ( {
692- heading : 'Post Failed' ,
693- body :
694- e . message || 'An error occurred while posting' ,
695- } ) ;
696- }
697- } ,
698- } ) ;
699- }
700-
701539 get widget ( ) {
702540 return this ;
703541 }
0 commit comments