Skip to content

Commit

Permalink
Merge pull request #5524 from jay-hodgson/SWC-6999
Browse files Browse the repository at this point in the history
SWC-6999: release Home Page v2
  • Loading branch information
jay-hodgson authored Sep 19, 2024
2 parents f724995 + 2625335 commit e428922
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public static class SynapseComponents {
public static ReactComponentType SynapseToastContainer;
public static ReactComponentType<EmptyProps> OAuthManagement;
public static ReactComponentType TrashCanList;
public static ReactComponentType<SynapseHomepageProps> SynapseHomepage;
public static ReactComponentType<SynapseHomepageV2Props> SynapseHomepageV2;
public static ReactComponentType<SynapseFooterProps> SynapseFooter;
public static ReactComponentType<ErrorPageProps> ErrorPage;
Expand Down

This file was deleted.

38 changes: 10 additions & 28 deletions src/main/java/org/sagebionetworks/web/client/view/HomeViewImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import org.sagebionetworks.web.client.FeatureFlagConfig;
import org.sagebionetworks.web.client.FeatureFlagKey;
import org.sagebionetworks.web.client.GlobalApplicationState;
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider;
import org.sagebionetworks.web.client.jsinterop.React;
import org.sagebionetworks.web.client.jsinterop.ReactElement;
import org.sagebionetworks.web.client.jsinterop.SRC;
import org.sagebionetworks.web.client.jsinterop.SynapseHomepageProps;
import org.sagebionetworks.web.client.jsinterop.SynapseHomepageV2Props;
import org.sagebionetworks.web.client.widget.ReactComponent;
import org.sagebionetworks.web.client.widget.header.Header;
Expand All @@ -29,23 +26,19 @@ public interface HomeViewImplUiBinder
private Header headerWidget;
private SynapseReactClientFullContextPropsProvider propsProvider;
private GlobalApplicationState globalAppState;
private FeatureFlagConfig featureFlagConfig;
private static final String PROJECT_VIEW_ID = "syn23593547.3";

@Inject
public HomeViewImpl(
HomeViewImplUiBinder binder,
Header headerWidget,
final SynapseReactClientFullContextPropsProvider propsProvider,
GlobalApplicationState globalAppState,
FeatureFlagConfig featureFlagConfig
GlobalApplicationState globalAppState
) {
initWidget(binder.createAndBindUi(this));

this.headerWidget = headerWidget;
this.propsProvider = propsProvider;
this.globalAppState = globalAppState;
this.featureFlagConfig = featureFlagConfig;
headerWidget.configure();
}

Expand All @@ -54,26 +47,15 @@ public void render() {
scrollToTop();
ReactElement component;

if (featureFlagConfig.isFeatureEnabled(FeatureFlagKey.HOMEPAGE_V2)) {
SynapseHomepageV2Props props = SynapseHomepageV2Props.create(href -> {
globalAppState.handleRelativePathClick(href);
});
component =
React.createElementWithSynapseContext(
SRC.SynapseComponents.SynapseHomepageV2,
props,
propsProvider.getJsInteropContextProps()
);
} else {
//TODO: SWC-6999: Once V2 is released, delete this conditional
SynapseHomepageProps props = SynapseHomepageProps.create(PROJECT_VIEW_ID);
component =
React.createElementWithSynapseContext(
SRC.SynapseComponents.SynapseHomepage,
props,
propsProvider.getJsInteropContextProps()
);
}
SynapseHomepageV2Props props = SynapseHomepageV2Props.create(href -> {
globalAppState.handleRelativePathClick(href);
});
component =
React.createElementWithSynapseContext(
SRC.SynapseComponents.SynapseHomepageV2,
props,
propsProvider.getJsInteropContextProps()
);

container.render(component);
}
Expand Down

0 comments on commit e428922

Please sign in to comment.