Skip to content

Commit

Permalink
Merge pull request #963 from WolframResearch/bugfix/PreferencesConten…
Browse files Browse the repository at this point in the history
…tCloudAppearance

Bugfix: Preferences Content Cloud Appearance
  • Loading branch information
rhennigan authored Nov 28, 2024
2 parents 3e422ba + a0370c7 commit 89931dc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 26 deletions.
2 changes: 1 addition & 1 deletion FrontEnd/TextResources/ChatbookStrings.tr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ChatToolbarInsertChatCell" -> "Insert Chat Cell",
"ChatToolbarChatSettings" -> "Chat Settings",
"ChatToolbarChatDrivenLabel" -> "Chat-Driven Notebook",
"ChatToolbarChatEnabledLabel" -> "Chat-Enabled Notebook",
"ChatToolbarChatEnabledLabel" -> "Chat Notebook",

"DefaultToolsLinks" -> "Links",

Expand Down
56 changes: 36 additions & 20 deletions Source/Chatbook/Dialogs.wl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ $headerMargins := If[ TrueQ @ $inDialog, $dialogHeaderMargins , $paneHeader
$subHeaderMargins := If[ TrueQ @ $inDialog, $dialogSubHeaderMargins, $paneSubHeaderMargins ];
$bodyMargins := If[ TrueQ @ $inDialog, $dialogBodyMargins , $paneBodyMargins ];

(* Copied from Dialog.nb stylesheet in order for buttons to render correctly on Cloud *)
$buttonCommonOptions = {
Alignment -> Center,
BaselinePosition -> Baseline, (* added since it's repeatedly used everywhere *)
FrameMargins -> 4,
FrameStyle -> None,
ImageSize -> { { 38, Full }, { 19.5, Full } },
RoundingRadius -> 3
};

$dialogTextBasic = {
FontFamily -> "Source Sans Pro",
FontSize -> 13,
PrivateFontOptions -> { "OperatorSubstitution" -> False }
}

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Create Dialogs*)
Expand Down Expand Up @@ -193,26 +209,26 @@ autoMargins0 // endDefinition;
(*grayDialogButtonLabel*)
grayDialogButtonLabel // beginDefinition;

grayDialogButtonLabel[ { normal_, hover_, pressed_ } ] /; $cloudNotebooks :=
grayDialogButtonLabel[ { normal_, hover_, pressed_ }, optsOverrides: OptionsPattern[ ] ] /; $cloudNotebooks :=
Mouseover[
Framed[ normal , BaseStyle -> "ButtonGray1Normal" , BaselinePosition -> Baseline ],
Framed[ hover , BaseStyle -> "ButtonGray1Hover" , BaselinePosition -> Baseline ],
BaseStyle -> "DialogTextBasic",
Framed[ normal , Sequence @@ Join[ Flatten @ { optsOverrides }, { BaseStyle -> { FontColor -> GrayLevel[ 20/51 ] }, Background -> GrayLevel[ 229/255 ] }, $buttonCommonOptions ] ],
Framed[ hover , Sequence @@ Join[ Flatten @ { optsOverrides }, { BaseStyle -> { FontColor -> GrayLevel[ 20/51 ] }, Background -> GrayLevel[ 49/51 ], FrameStyle -> GrayLevel[ 229/255 ] }, $buttonCommonOptions ] ],
BaseStyle -> $dialogTextBasic,
ContentPadding -> False,
ImageSize -> All
];

grayDialogButtonLabel[ { normal_, hover_, pressed_ } ] :=
grayDialogButtonLabel[ { normal_, hover_, pressed_ }, optsOverrides: OptionsPattern[ ] ] :=
NotebookTools`Mousedown[
Framed[ normal , BaseStyle -> "ButtonGray1Normal" , BaselinePosition -> Baseline ],
Framed[ hover , BaseStyle -> "ButtonGray1Hover" , BaselinePosition -> Baseline ],
Framed[ pressed, BaseStyle -> "ButtonGray1Pressed", BaselinePosition -> Baseline ],
Framed[ normal , optsOverrides, BaseStyle -> "ButtonGray1Normal" , BaselinePosition -> Baseline ],
Framed[ hover , optsOverrides, BaseStyle -> "ButtonGray1Hover" , BaselinePosition -> Baseline ],
Framed[ pressed, optsOverrides, BaseStyle -> "ButtonGray1Pressed", BaselinePosition -> Baseline ],
BaseStyle -> "DialogTextBasic"
];

grayDialogButtonLabel[ { normal_, hover_ } ] := grayDialogButtonLabel[ { normal, hover, hover } ];
grayDialogButtonLabel[ { normal_, hover_ }, opts: OptionsPattern[ ] ] := grayDialogButtonLabel[ { normal, hover, hover }, opts ];

grayDialogButtonLabel[ label_ ] := grayDialogButtonLabel[ { label, label, label } ];
grayDialogButtonLabel[ label_, opts: OptionsPattern[ ] ] := grayDialogButtonLabel[ { label, label, label }, opts ];

grayDialogButtonLabel // endDefinition;

Expand All @@ -221,26 +237,26 @@ grayDialogButtonLabel // endDefinition;
(*redDialogButtonLabel*)
redDialogButtonLabel // beginDefinition;

redDialogButtonLabel[ { normal_, hover_, pressed_ } ] /; $cloudNotebooks :=
redDialogButtonLabel[ { normal_, hover_, pressed_ }, optsOverrides: OptionsPattern[ ] ] /; $cloudNotebooks :=
Mouseover[
Framed[ normal , BaseStyle -> "ButtonRed1Normal" , BaselinePosition -> Baseline ],
Framed[ hover , BaseStyle -> "ButtonRed1Hover" , BaselinePosition -> Baseline ],
BaseStyle -> "DialogTextBasic",
Framed[ normal , Sequence @@ Join[ Flatten @ { optsOverrides }, { BaseStyle -> { FontColor -> GrayLevel[ 1 ] }, Background -> RGBColor[ 13/15, 1/15, 0 ] }, $buttonCommonOptions ] ],
Framed[ hover , Sequence @@ Join[ Flatten @ { optsOverrides }, { BaseStyle -> { FontColor -> GrayLevel[ 1 ] }, Background -> RGBColor[ 254/255, 0, 0 ] }, $buttonCommonOptions ] ],
BaseStyle -> $dialogTextBasic,
ContentPadding -> False,
ImageSize -> All
];

redDialogButtonLabel[ { normal_, hover_, pressed_ } ] :=
redDialogButtonLabel[ { normal_, hover_, pressed_ }, optsOverrides: OptionsPattern[ ] ] :=
NotebookTools`Mousedown[
Framed[ normal , BaseStyle -> "ButtonRed1Normal" , BaselinePosition -> Baseline ],
Framed[ hover , BaseStyle -> "ButtonRed1Hover" , BaselinePosition -> Baseline ],
Framed[ pressed, BaseStyle -> "ButtonRed1Pressed", BaselinePosition -> Baseline ],
Framed[ normal , optsOverrides, BaseStyle -> "ButtonRed1Normal" , BaselinePosition -> Baseline ],
Framed[ hover , optsOverrides, BaseStyle -> "ButtonRed1Hover" , BaselinePosition -> Baseline ],
Framed[ pressed, optsOverrides, BaseStyle -> "ButtonRed1Pressed", BaselinePosition -> Baseline ],
BaseStyle -> "DialogTextBasic"
];

redDialogButtonLabel[ { normal_, hover_ } ] := redDialogButtonLabel[ { normal, hover, hover } ];
redDialogButtonLabel[ { normal_, hover_ }, opts: OptionsPattern[ ] ] := redDialogButtonLabel[ { normal, hover, hover }, opts ];

redDialogButtonLabel[ label_ ] := redDialogButtonLabel[ { label, label, label } ];
redDialogButtonLabel[ label_, opts: OptionsPattern[ ] ] := redDialogButtonLabel[ { label, label, label }, opts ];

redDialogButtonLabel // endDefinition;

Expand Down
9 changes: 4 additions & 5 deletions Source/Chatbook/PreferencesContent.wl
Original file line number Diff line number Diff line change
Expand Up @@ -1218,10 +1218,7 @@ makeLLMPanel[ ] :=
Module[ { subscribeButton, username, signInButton, manageButton },
subscribeButton =
Button[
NotebookTools`Mousedown[
Framed[ tr[ "PreferencesContentLLMKitSubscribeButton" ], BaseStyle -> "ButtonRed1Normal", FrameMargins -> { { 17, 17 }, { 7, 7 } } ],
Framed[ tr[ "PreferencesContentLLMKitSubscribeButton" ], BaseStyle -> "ButtonRed1Hover", FrameMargins -> { { 17, 17 }, { 7, 7 } } ],
Framed[ tr[ "PreferencesContentLLMKitSubscribeButton" ], BaseStyle -> "ButtonRed1Pressed", FrameMargins -> { { 17, 17 }, { 7, 7 } } ] ],
redDialogButtonLabel[ tr[ "PreferencesContentLLMKitSubscribeButton" ], FrameMargins -> { { 17, 17 }, { 7, 7 } } ],
Wolfram`LLMFunctions`Common`OpenLLMKitURL @ "Buy",
Appearance -> "Suppressed",
BaseStyle -> "DialogTextCommon",
Expand All @@ -1237,7 +1234,7 @@ makeLLMPanel[ ] :=
Grid[
{ {
RawBoxes @ DynamicBox[ FEPrivate`FrontEndResource[ "FEBitmaps", "GenericUserIcon" ][ GrayLevel[ 0.2 ] ] ],
Dynamic[ FrontEnd`CurrentValue["WolframCloudFullUserName"] ] } },
If[ $CloudEvaluation, Dynamic[ $CloudAccountName ], Dynamic[ FrontEnd`CurrentValue["WolframCloudFullUserName"] ] ] } },
Alignment -> { Left, Baseline },
BaseStyle -> { FontColor -> GrayLevel[ 0.2 ], FontSize -> 14 },
BaselinePosition -> { 1, 2 } ] },
Expand Down Expand Up @@ -1976,6 +1973,8 @@ highlightControl // endDefinition;
(*highlightColor*)
highlightColor // beginDefinition;

highlightColor[ tab_, id_ ] /; $CloudEvaluation := None

highlightColor[ tab_, id_ ] :=
With[
{
Expand Down

0 comments on commit 89931dc

Please sign in to comment.