Skip to content

Commit

Permalink
Merge pull request #1 from hicommonwealth/homepage
Browse files Browse the repository at this point in the history
Fix Homepage Redirect Behavior
  • Loading branch information
jackhmarcus authored May 15, 2021
2 parents d274a82 + 55454c3 commit 7287046
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 63 deletions.
5 changes: 2 additions & 3 deletions client/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import { Layout, LoadingLayout } from 'views/layout';
import ConfirmInviteModal from 'views/modals/confirm_invite_modal';
import LoginModal from 'views/modals/login_modal';
import { alertModalWithText } from 'views/modals/alert_modal';
import Login from './views/components/login';

// Prefetch commonly used pages
import(/* webpackPrefetch: true */ 'views/pages/home');
import(/* webpackPrefetch: true */ 'views/pages/landing');
import(/* webpackPrefetch: true */ 'views/pages/commonwealth');
import(/* webpackPrefetch: true */ 'views/pages/discussions');
Expand Down Expand Up @@ -618,7 +618,6 @@ $(() => {

// Landing pages
'/': importRoute('views/pages/landing', { scoped: false, hideSidebar: true }),
'/dashboard': importRoute('views/pages/home', { scoped: false, hideSidebar: true }),
'/whyCommonWealth': importRoute('views/pages/commonwealth', { scoped: false, hideSidebar: true }),
'/about': importRoute('views/pages/landing/about', { scoped: false }),
'/terms': importRoute('views/pages/landing/terms', { scoped: false }),
Expand Down Expand Up @@ -749,7 +748,7 @@ $(() => {
if (app.loginState === LoginState.LoggedIn) {
app.user.notifications.refresh().then(() => m.redraw());
jwt = app.user.jwt;
m.route.set('/dashboard');
m.route.set('/');
}
// grab discussion drafts
if (app.loginState === LoginState.LoggedIn) {
Expand Down
44 changes: 0 additions & 44 deletions client/scripts/views/pages/home/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion client/scripts/views/pages/landing/chains_slider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import m from 'mithril';
import './chains_slider.scss';
import 'pages/landing/chains_slider.scss';

interface IState {
chains: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'pages/home/community_cards.scss';
import 'pages/landing/community_cards.scss';

import m from 'mithril';
import { Button, Icon, Icons, Card, Tag } from 'construct-ui';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './creators_card_section.scss';
import 'pages/landing/creators_card_section.scss';
import m from 'mithril';

import { ICardListItem } from 'models/interfaces';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './crowdfunding_card_section.scss';
import 'pages/landing/crowdfunding_card_section.scss';
import m from 'mithril';

import { ICardListItem } from 'models/interfaces';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import m from 'mithril';
import './find_your_community_section.scss';
import LandingPageButton from './landing_page_button';
import 'pages/landing/find_your_community_section.scss';

interface IState {
holders: {
Expand Down
46 changes: 39 additions & 7 deletions client/scripts/views/pages/landing/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import m from 'mithril';
import './landing_page.scss';
// Logged Out Homepage View
import 'pages/landing/landing_page.scss';
import Glide from '@glidejs/glide';

import app from 'state';
import app, { LoginState } from 'state';

import HeaderLandingPage from './landing_page_header';
import FooterLandingPage from './landing_page_footer';
Expand All @@ -13,6 +14,12 @@ import TokensChainsComponent from './chains_slider';
import TokenHoldersComponent from './find_your_community_section';
import ChainsCrowdfundingComponent from './crowdfunding_card_section';

// Logged In Homepage View
import 'pages/landing/index.scss';

import Sublayout from 'views/sublayout';
import CommunityCards from './community_cards';

interface Chain {
img: string;
id: string;
Expand All @@ -26,7 +33,6 @@ interface IState {
hiddenInputTokenList: boolean;
inputTokenValue: string;
}

const LandingPage: m.Component<{}, IState> = {
oninit: (vnode) => {
vnode.state.hiddenInputTokenList = true;
Expand Down Expand Up @@ -102,7 +108,8 @@ const LandingPage: m.Component<{}, IState> = {
];
},
view: (vnode) => {
return m('.LandingPage', { class: 'bg-primary' }, [
if (app.loginState !== LoginState.LoggedIn) {
return m('.LandingPage', { class: 'bg-primary' }, [
m(
'div',
{ class: 'absolute w-screen z-20' },
Expand Down Expand Up @@ -331,8 +338,33 @@ const LandingPage: m.Component<{}, IState> = {
'sha512-wCwx+DYp8LDIaTem/rpXubV/C1WiNRsEVqoztV0NZm8tiTvsUeSlA/Uz02VTGSiqfzAHD4RnqVoevMcRZgYEcQ==',
crossorigin: 'anonymous',
}),
]);
},
};
]);
} else {
return m(Sublayout, {
class: 'Homepage',
hero: m('.hero-unit', [
m('.layout-container', [
m('.hero-unit-left', [
m('.hero-image', [
m('.hero-image-inner', [
m('img', { src: '/static/img/hero_icon.png' }),
]),
]),
]),
m('.hero-unit-right', [
m('h2', 'Discussions and governance for decentralized communities'),
m('p', [
'Commonwealth lets you conduct ongoing discussions, manage on-chain proposals, ',
'and poll community members from one simple interface.',
]),
]),
]),
]),
}, [
m(CommunityCards),
]);
}
}
}

export default LandingPage;
2 changes: 1 addition & 1 deletion client/scripts/views/pages/landing/landing_page_footer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import m from 'mithril';
import './landing_page_footer.scss';
import 'pages/landing/landing_page_footer.scss';

interface IState {
list: { text: string; redirectTo: string }[];
Expand Down
2 changes: 1 addition & 1 deletion client/scripts/views/pages/landing/landing_page_header.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import m from 'mithril';
import './landing_page_header.scss';
import 'pages/landing/landing_page_header.scss';
import app from 'state';
import LoginModal from 'views/modals/login_modal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import m from 'mithril';
import FindYourTokenInputComponent from './find_your_token_input';
import InputTokensListComponent from './input_tokens_lists';

import './tokens_community_hero.scss';
import 'pages/landing/tokens_community_hero.scss';

interface Chain {
img: string;
Expand Down
File renamed without changes.

0 comments on commit 7287046

Please sign in to comment.