Skip to content

Commit 1d54611

Browse files
update code footer buttons to be active only when if it is set for flutter
1 parent 439d2ed commit 1d54611

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

app/lib/pages/code/code-screen.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ export function CodeScreen() {
166166
/>
167167
</CodeWrapper>
168168

169-
<CodeScreenFooter app={app} scene={selection?.node as any} />
169+
<CodeScreenFooter
170+
framework={useroption.framework}
171+
app={app}
172+
scene={selection?.node as any}
173+
/>
170174
</div>
171175
);
172176
}

app/lib/pages/code/footer-action/code-screen-footer.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { PluginSdk } from "@plugin-sdk/app";
66
import { preview } from "../../../scene-view";
77
import { NextUploadButton } from "./next-upload-button";
88
import type { ReflectSceneNode } from "@design-sdk/core/nodes";
9+
import { Framework } from "../framework-option";
910

1011
interface ICodeScreenFooter {
12+
framework: Framework;
1113
app?: any;
1214
scene?: ReflectSceneNode;
1315
}
@@ -35,12 +37,17 @@ export function CodeScreenFooter(props: ICodeScreenFooter) {
3537
// ANALYTICS
3638
analytics.event_click_quicklook();
3739
};
40+
41+
/** currently we only support uploading & preview for flutter */
42+
const _can_enable_next = props.framework == Framework.flutter && !!props.app;
43+
const _can_show_preview = props.framework == Framework.flutter && !!props.app;
44+
3845
return (
3946
<CodeFooterCtaWrapper>
4047
{
4148
<>
42-
<NextUploadButton {...props} />
43-
{props.app && (
49+
<NextUploadButton disabled={!_can_enable_next} {...props} />
50+
{_can_show_preview && (
4451
<PreviewButton
4552
disabled={isLaunchingConsole}
4653
onClick={onQuickLookClicked}

app/lib/pages/code/footer-action/next-upload-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { PluginSdk } from "@plugin-sdk/app";
66
import type { IReflectNodeReference } from "@design-sdk/core/nodes/lignt";
77

88
export function NextUploadButton(props: {
9+
disabled?: boolean;
910
scene?: IReflectNodeReference;
1011
app?: any;
1112
}) {
@@ -40,7 +41,7 @@ export function NextUploadButton(props: {
4041
};
4142
return (
4243
<NextStepButton
43-
disabled={!props.app || isLoading}
44+
disabled={props.disabled || isLoading}
4445
onClick={() => {
4546
register()
4647
.then((d) => {

0 commit comments

Comments
 (0)