Skip to content

Commit 6f8272d

Browse files
committed
chore: phoenix pro branding changes
1 parent 5096499 commit 6f8272d

File tree

8 files changed

+120
-10
lines changed

8 files changed

+120
-10
lines changed

src/assets/new-project/assets/css/responsive.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
width: 100%;
3737
}
3838

39-
.editor-name h4 {
39+
.editor-name h4, .editor-name h4 span {
4040
font-size: 22px;
4141
}
4242

@@ -79,21 +79,21 @@
7979
margin-left: 0px;
8080
width: 48%;
8181
}
82-
82+
8383
.project-content-right {
8484
width: 48%;
8585

8686
}
87-
87+
8888
.website-detail input {
8989
width: 242px;
9090
height: 42px;
9191
}
92-
92+
9393
#noProjectIframe {
9494
width: 267px;
9595
}
96-
96+
9797
}
9898

9999
@media (max-width: 650px) {

src/assets/new-project/assets/js/code-editor.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,36 @@ function _openURLInTauri(url) {
183183
}
184184
}
185185

186+
function _updateProBranding() {
187+
try {
188+
const $freeTitle = $('.phoenix-free-title');
189+
const $proTitle = $('.phoenix-pro-title');
190+
const $proTitleSpan = $('.pro-plan-name');
191+
192+
if (!$freeTitle.length || !$proTitle.length || !$proTitleSpan.length) {
193+
console.warn('Pro branding elements not found');
194+
return;
195+
}
196+
197+
// Get plan info from window.top.Phoenix.pro.plan
198+
const planInfo = window.top.Phoenix && window.top.Phoenix.pro && window.top.Phoenix.pro.plan;
199+
200+
if (planInfo && planInfo.paidSubscriber) {
201+
// Hide free title, show pro title
202+
$freeTitle.addClass('forced-hidden');
203+
$proTitle.removeClass('forced-hidden');
204+
// Update plan name
205+
$proTitleSpan.text(planInfo.name || 'Phoenix Pro');
206+
} else {
207+
// Show free title, hide pro title
208+
$freeTitle.removeClass('forced-hidden');
209+
$proTitle.addClass('forced-hidden');
210+
}
211+
} catch (error) {
212+
console.error('Error updating pro branding:', error);
213+
}
214+
}
215+
186216
function initCodeEditor() {
187217
document.getElementById("openFolderBtn").onclick = function() {
188218
Metrics.countEvent(Metrics.EVENT_TYPE.NEW_PROJECT, "main.Click", "open-folder");
@@ -252,4 +282,5 @@ function initCodeEditor() {
252282
_showFirstTimeExperience();
253283
$("body").append($(`<script async defer src="https://buttons.github.io/buttons.js"></script>`));
254284
_attachSettingBtnEventListeners();
285+
_updateProBranding();
255286
}

src/assets/new-project/code-editor.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515
<script src="../../thirdparty/floating-ui.core.umd.min.js"></script>
1616
<script src="../../thirdparty/floating-ui.dom.umd.min.js"></script>
1717
<script src="assets/js/notification-ui.js"></script>
18+
<style>
19+
.phoenix-pro-title {
20+
background: linear-gradient(
21+
45deg,
22+
#ff8c42, /* deep orange */
23+
#ffa500, /* bright orange */
24+
#ffcc70, /* golden yellow */
25+
#ffd700 /* rich gold */
26+
);
27+
background-clip: text;
28+
-webkit-background-clip: text; /* Chrome, Safari */
29+
color: transparent; /* works in Firefox */
30+
-webkit-text-fill-color: transparent; /* Chrome, Safari */
31+
display: inline-block;
32+
}
33+
</style>
1834
</head>
1935
<body id="top" onload="init(); initCodeEditor();">
2036
<div class="code-editor-card">
@@ -24,7 +40,8 @@
2440
<img src="images/logo.png" alt="image"/>
2541
</div>
2642
<div class="editor-name">
27-
<h4 class="localize">{{APP_TITLE}}</h4>
43+
<h4 class="localize phoenix-free-title">{{APP_TITLE}}</h4>
44+
<h4 class="phoenix-pro-title forced-hidden"><a href="https://account.phcode.dev" target="_blank" rel="noopener" class="phoenix-pro"><span class="pro-plan-name">Phoenix Pro</span><i class="fa-solid fa-feather orange-gold" style="margin-left: 4px;"></i></a></h4>
2845
<!-- Place this tag where you want the button to render. -->
2946
<div style="display: flex; justify-content: space-between;">
3047
<span class="localize">{{BUILD_THE_WEB}}</span>

src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@
350350
baseURL: _getBaseURL(),
351351
isTestWindow: _isTestWindow(),
352352
firstBoot: false, // will be set below
353+
pro: {},
353354
startTime: Date.now(),
354355
TRUSTED_ORIGINS: {
355356
// if modifying this list, make sure to update in https://github.com/phcode-dev/phcode.live/blob/main/docs/trustedOrigins.js

src/services/profile-menu.js

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,43 @@ define(function (require, exports, module) {
184184
_setupDocumentClickHandler();
185185
}
186186

187+
/**
188+
* Update main navigation branding based on entitlements
189+
*/
190+
function _updateBranding(entitlements) {
191+
const $brandingLink = $("#phcode-io-main-nav");
192+
if (!entitlements) {
193+
Phoenix.pro.plan = {
194+
paidSubscriber: false,
195+
name: "Community Edition",
196+
isInTrial: false
197+
};
198+
return;
199+
}
200+
201+
if (entitlements && entitlements.plan){
202+
Phoenix.pro.plan = {
203+
paidSubscriber: entitlements.plan.paidSubscriber,
204+
name: entitlements.plan.name,
205+
isInTrial: entitlements.plan.isInTrial,
206+
validTill: entitlements.plan.validTill
207+
};
208+
}
209+
if (entitlements && entitlements.plan && entitlements.plan.paidSubscriber) {
210+
// Paid subscriber: show plan name with feather icon
211+
const planName = entitlements.plan.name || "Phoenix Pro";
212+
$brandingLink
213+
.attr("href", "https://account.phcode.dev")
214+
.addClass("phoenix-pro")
215+
.html(`${planName}<i class="fa-solid fa-feather orange-gold" style="margin-left: 3px;"></i>`);
216+
} else {
217+
// Free user: show phcode.io branding
218+
$brandingLink
219+
.attr("href", "https://phcode.io")
220+
.removeClass("phoenix-pro")
221+
.text("phcode.io");
222+
}
223+
}
187224

188225
let userEmail="";
189226
class SecureEmail extends HTMLElement {
@@ -366,7 +403,7 @@ define(function (require, exports, module) {
366403
isPopupVisible = true;
367404

368405
positionPopup();
369-
406+
370407
// Apply cached entitlements immediately if available (including quota/messages)
371408
KernalModeTrust.loginService.getEntitlements(false).then(cachedEntitlements => {
372409
if (cachedEntitlements && isPopupVisible) {
@@ -504,6 +541,9 @@ define(function (require, exports, module) {
504541

505542
// Clear cached entitlements when user logs out
506543
LoginService.clearEntitlements();
544+
545+
// Reset branding to free mode
546+
_updateBranding(null);
507547
}
508548

509549
function setLoggedIn(initial, color) {
@@ -514,9 +554,11 @@ define(function (require, exports, module) {
514554
_updateProfileIcon(initial, color);
515555

516556
// Preload entitlements when user logs in
517-
KernalModeTrust.loginService.getEntitlements().catch(error => {
518-
console.error('Failed to preload entitlements on login:', error);
519-
});
557+
KernalModeTrust.loginService.getEntitlements()
558+
.then(_updateBranding)
559+
.catch(error => {
560+
console.error('Failed to preload entitlements on login:', error);
561+
});
520562
}
521563

522564
exports.init = init;

src/styles/brackets.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ html, body {
8282
color: @dark-bc-text-link;
8383
}
8484

85+
#phcode-io-main-nav.phoenix-pro{
86+
background: @phoenix-pro-gradient;
87+
background-clip: text;
88+
-webkit-background-clip: text; /* Chrome, Safari */
89+
color: transparent; /* works in Firefox */
90+
-webkit-text-fill-color: transparent; /* Chrome, Safari */
91+
display: inline-block;
92+
}
93+
8594
#ctrl-nav-overlay {
8695
position: absolute;
8796
display: flex; /* Enable flexbox */

src/styles/brackets_core_ui_variables.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,12 @@
279279
// CSS Codehint icon
280280
@css-codehint-icon: #2ea56c;
281281
@dark-css-codehint-icon: #146a41;
282+
283+
// phoenix pro
284+
@phoenix-pro-gradient: linear-gradient(
285+
45deg,
286+
#ff8c42, /* deep orange */
287+
#ffa500, /* bright orange */
288+
#ffcc70, /* golden yellow */
289+
#ffd700 /* rich gold */
290+
);

test/SpecRunner.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@
270270
isSpecRunnerWindow: window.location.pathname.endsWith("/SpecRunner.html"),
271271
firstBoot: false, // will be set below
272272
startTime: Date.now(),
273+
pro: {},
273274
TRUSTED_ORIGINS: {
274275
// if modifying this list, make sure to update in https://github.com/phcode-dev/phcode.live/blob/main/docs/trustedOrigins.js
275276
// extensions may add their trusted origin to this list at any time.

0 commit comments

Comments
 (0)