From ffc81ff476da41c50f43cbf79bf60fa7c371c3b0 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Fri, 26 Apr 2019 14:17:22 -0400 Subject: [PATCH 01/10] Wrap 'Authorize' text in Typograhpy element --- src/pages/Welcome.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index 40b4769..349bd6b 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -333,7 +333,7 @@ class WelcomePage extends Component { size="large" href={this.state.authUrl? this.state.authUrl: ""} > - Authorize + Authorize
From c9dd04a6c482c7b1252abd3f60637403d499039f Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Fri, 26 Apr 2019 15:53:40 -0400 Subject: [PATCH 02/10] Add version number and changed login help string --- src/pages/Welcome.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index 349bd6b..e38b2aa 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -34,6 +34,7 @@ interface IWelcomeState { openAuthDialog: boolean; authCode: string; emergencyMode: boolean; + version: string; } class WelcomePage extends Component { @@ -53,7 +54,8 @@ class WelcomePage extends Component { defaultRedirectAddress: '', openAuthDialog: false, authCode: '', - emergencyMode: false + emergencyMode: false, + version: '' } getConfig().then((result: any) => { @@ -68,7 +70,8 @@ class WelcomePage extends Component { federates: result.federated? result.federated === "true": true, license: result.license.url, repo: result.repository, - defaultRedirectAddress: result.location != "dynamic"? result.location: `https://${window.location.host}` + defaultRedirectAddress: result.location != "dynamic"? result.location: `https://${window.location.host}`, + version: result.version }); }).catch(() => { console.error('config.json is missing. If you want to customize Hyperspace, please include config.json'); @@ -276,9 +279,9 @@ class WelcomePage extends Component {
this.updateUserInfo(event.target.value)} error={this.state.userInputError} onBlur={() => this.checkForErrors()} @@ -288,7 +291,7 @@ class WelcomePage extends Component { }
{ - this.state.registerBase? If you are from {this.state.registerBase? this.state.registerBase: "noinstance"}, sign in with your username.: null + this.state.registerBase? Not from {this.state.registerBase? this.state.registerBase: "noinstance"}? Sign in with your full username.: null }
{ @@ -423,6 +426,9 @@ class WelcomePage extends Component { { this.state.repo? Source code | : null}License | File an Issue + + {this.state.brandName? this.state.brandName: "Hypersapce"} v.{this.state.version} {this.state.brandName && this.state.brandName !== "Hyperspace"? "(Hyperspace-like)": null} + {this.showAuthDialog()}
From b9af9cc26fa6a79585b01ffea3976d512c41b39a Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 12:28:10 -0400 Subject: [PATCH 03/10] Change Attract theme colors --- src/types/HyperspaceTheme.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/HyperspaceTheme.tsx b/src/types/HyperspaceTheme.tsx index b6ad365..ad65178 100644 --- a/src/types/HyperspaceTheme.tsx +++ b/src/types/HyperspaceTheme.tsx @@ -114,10 +114,10 @@ export const attractTheme: HyperspaceTheme = { name: "Attract", palette: { primary: { - main: '#f5f5f5', + main: '#E57373', }, secondary: { - main: "#1a237e", + main: "#78909C", } } } From a862ec5ab02491d82ca237c06839ef38f4eba43b Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 12:34:58 -0400 Subject: [PATCH 04/10] Replace King theme with Classic theme --- src/types/HyperspaceTheme.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/types/HyperspaceTheme.tsx b/src/types/HyperspaceTheme.tsx index ad65178..ab22cb2 100644 --- a/src/types/HyperspaceTheme.tsx +++ b/src/types/HyperspaceTheme.tsx @@ -71,12 +71,16 @@ export const entertainerTheme: HyperspaceTheme = { } } -export const kingTheme: HyperspaceTheme = { - key: "kingTheme", - name: "Royal II", +export const classicTheme: HyperspaceTheme = { + key: "classicTheme", + name: "Classic", palette: { - primary: deepPurple, - secondary: amber + primary: { + main: "#555555" + }, + secondary: { + main: "#5c2d91" + } } } @@ -122,4 +126,4 @@ export const attractTheme: HyperspaceTheme = { } } -export const themes = [defaultTheme, gardenerTheme, teacherTheme, jokerTheme, guardTheme, entertainerTheme, kingTheme, dragonTheme, memoriumTheme, blissTheme, attractTheme] \ No newline at end of file +export const themes = [defaultTheme, gardenerTheme, teacherTheme, jokerTheme, guardTheme, entertainerTheme, classicTheme, dragonTheme, memoriumTheme, blissTheme, attractTheme] \ No newline at end of file From 36aa75464dc92c3e9df2c7e5b711ecac92bfa303 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 12:43:43 -0400 Subject: [PATCH 05/10] Add emptyTextPadding, change no results for accounts section in search --- src/pages/Notifications.tsx | 2 +- src/pages/PageLayout.styles.tsx | 6 +++++- src/pages/Recommendations.tsx | 4 ++-- src/pages/Search.tsx | 23 ++++++++++++++--------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/pages/Notifications.tsx b/src/pages/Notifications.tsx index 24b6a18..2a3abdb 100644 --- a/src/pages/Notifications.tsx +++ b/src/pages/Notifications.tsx @@ -252,7 +252,7 @@ class NotificationsPage extends Component { : -
+
All clear! It looks like you have no notifications. Why not get the conversation going with a new post?
: diff --git a/src/pages/PageLayout.styles.tsx b/src/pages/PageLayout.styles.tsx index 43d2731..155005d 100644 --- a/src/pages/PageLayout.styles.tsx +++ b/src/pages/PageLayout.styles.tsx @@ -52,6 +52,10 @@ export const styles = (theme: Theme) => createStyles({ marginLeft: 250, }, }, + pageLayoutEmptyTextConstraints: { + paddingLeft: theme.spacing.unit * 2, + paddingRight: theme.spacing.unit * 2 + }, pageHeroBackground: { position: 'relative', height: 'intrinsic', @@ -174,5 +178,5 @@ export const styles = (theme: Theme) => createStyles({ '& a': { color: theme.palette.primary.light } - } + }, }); \ No newline at end of file diff --git a/src/pages/Recommendations.tsx b/src/pages/Recommendations.tsx index 9eb8dc8..b43f789 100644 --- a/src/pages/Recommendations.tsx +++ b/src/pages/Recommendations.tsx @@ -201,7 +201,7 @@ class RecommendationsPage extends Component 0? this.showFollowRequests(): -
+
You don't have any follow requests.
@@ -210,7 +210,7 @@ class RecommendationsPage extends Component { this.state.followSuggestions && this.state.followSuggestions.length > 0? this.showFollowSuggestions(): -
+
We don't have any suggestions for you. Why not interact with the fediverse a bit by creating a new post?
diff --git a/src/pages/Search.tsx b/src/pages/Search.tsx index d6708db..5f16932 100644 --- a/src/pages/Search.tsx +++ b/src/pages/Search.tsx @@ -164,11 +164,12 @@ class SearchPage extends Component { return (
Accounts - - + { - this.state.results? - this.state.results.accounts.map((acct: Account) => { + this.state.results && this.state.results.accounts.length > 0? + + + { this.state.results.accounts.map((acct: Account) => { return ( @@ -189,16 +190,19 @@ class SearchPage extends Component { ); - }): null + })} + + : No results found } - - + +
) } showAllPostsFromQuery() { + const {classes} = this.props; return (
Posts @@ -207,13 +211,14 @@ class SearchPage extends Component { this.state.results.statuses.length > 0? this.state.results.statuses.map((post: Status) => { return - }): No results found.: null + }): No results found.: null }
); } showAllPostsWithTag() { + const {classes} = this.props; return (
Tagged posts @@ -222,7 +227,7 @@ class SearchPage extends Component { this.state.tagResults.length > 0? this.state.tagResults.map((post: Status) => { return - }): No results found.: null + }): No results found.: null }
); From d06b91d8bc410385fc3d9a203cc9d03d8030f597 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 13:21:24 -0400 Subject: [PATCH 06/10] Disable public visibility in Settings when defederated --- src/pages/Settings.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 76b7720..5fe8e5c 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -24,7 +24,7 @@ import { } from '@material-ui/core'; import OpenInNewIcon from '@material-ui/icons/OpenInNew'; import {styles} from './PageLayout.styles'; -import {setUserDefaultBool, getUserDefaultBool, getUserDefaultTheme, setUserDefaultTheme, getUserDefaultVisibility, setUserDefaultVisibility} from '../utilities/settings'; +import {setUserDefaultBool, getUserDefaultBool, getUserDefaultTheme, setUserDefaultTheme, getUserDefaultVisibility, setUserDefaultVisibility, getConfig} from '../utilities/settings'; import {canSendNotifications, browserSupportsNotificationRequests} from '../utilities/notifications'; import {themes, defaultTheme} from '../types/HyperspaceTheme'; import ThemePreview from '../components/ThemePreview'; @@ -43,6 +43,7 @@ interface ISettingsState { resetSettingsDialog: boolean; previewTheme: Theme; defaultVisibility: Visibility; + federated: boolean; } class SettingsPage extends Component { @@ -61,7 +62,8 @@ class SettingsPage extends Component { resetHyperspaceDialog: false, resetSettingsDialog: false, previewTheme: setHyperspaceTheme(getUserDefaultTheme()) || setHyperspaceTheme(defaultTheme), - defaultVisibility: getUserDefaultVisibility() || "public" + defaultVisibility: getUserDefaultVisibility() || "public", + federated: true } this.toggleDarkMode = this.toggleDarkMode.bind(this); @@ -75,6 +77,16 @@ class SettingsPage extends Component { this.setVisibility = this.setVisibility.bind(this); } + componentDidMount() { + this.getFederatedStatus(); + } + + getFederatedStatus() { + getConfig().then((config: any) => { + this.setState({ federated: config.federated === "true" }); + }) + } + toggleDarkMode() { this.setState({ darkModeEnabled: !this.state.darkModeEnabled }); setUserDefaultBool('darkModeEnabled', !this.state.darkModeEnabled); @@ -208,7 +220,7 @@ class SettingsPage extends Component { value={this.state.defaultVisibility} onChange={(e, value) => this.changeVisibility(value as Visibility)} > - } label={"Public"} /> + } label={`Public ${this.state.federated? "": "(disabled by provider)"}`} disabled={!this.state.federated}/> } label={"Unlisted"} /> } label={"Private (followers only)"} /> } label={"Direct"} /> From 48a68c5ee64c4cec27c0120de3d53a16fdd77de6 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 13:24:24 -0400 Subject: [PATCH 07/10] Hide Public option in composer visibility (#28) --- src/pages/Compose.tsx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/pages/Compose.tsx b/src/pages/Compose.tsx index 36f120e..3001474 100644 --- a/src/pages/Compose.tsx +++ b/src/pages/Compose.tsx @@ -20,7 +20,7 @@ import ComposeMediaAttachment from '../components/ComposeMediaAttachment'; import EmojiPicker from '../components/EmojiPicker'; import { DateTimePicker, MuiPickersUtilsProvider } from 'material-ui-pickers'; import MomentUtils from '@date-io/moment'; -import { getUserDefaultVisibility } from '../utilities/settings'; +import { getUserDefaultVisibility, getConfig } from '../utilities/settings'; interface IComposerState { account: UAccount; @@ -36,6 +36,7 @@ interface IComposerState { poll?: PollWizard; pollExpiresDate?: any; showEmojis: boolean; + federated: boolean; } class Composer extends Component { @@ -54,20 +55,26 @@ class Composer extends Component { visibilityMenu: false, text: '', remainingChars: 500, - showEmojis: false + showEmojis: false, + federated: true } } componentDidMount() { let state = this.getComposerParams(this.props); let text = state.acct? `@${state.acct}: `: ''; - this.setState({ - reply: state.reply, - acct: state.acct, - visibility: state.visibility, - text, - remainingChars: 500 - text.length + getConfig().then((config: any) => { + this.setState({ + federated: config.federated === "true", + reply: state.reply, + acct: state.acct, + visibility: state.visibility, + text, + remainingChars: 500 - text.length + }); }) + + } componentWillReceiveProps(props: any) { @@ -499,7 +506,7 @@ class Composer extends Component { this.changeVisibility('direct')}>Direct (direct message) this.changeVisibility('private')}>Private (followers only) this.changeVisibility('unlisted')}>Unlisted - this.changeVisibility('public')}>Public + {this.state.federated? this.changeVisibility('public')}>Public: null} From db3913ddc3cf6fb1808fed8a1dcef706d19028a8 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 13:37:36 -0400 Subject: [PATCH 08/10] Add stricter input checking on usernames based on federation --- src/pages/Welcome.tsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index 40b4769..ae3144e 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -134,7 +134,7 @@ class WelcomePage extends Component { } getLoginUser(user: string) { - if (user.includes("@")) { + if (this.state.federates || user.includes("@")) { let newUser = user; this.setState({ user: newUser }) return "https://" + newUser.split("@")[1]; @@ -222,17 +222,28 @@ class WelcomePage extends Component { return true; } else { if (this.state.user.includes("@")) { - let baseUrl = this.state.user.split("@")[1]; - axios.get("https://" + baseUrl + "/api/v1/timelines/public").catch((err: Error) => { - let userInputError = true; - let userInputErrorMessage = "Instance name is invalid."; + if (this.state.federates && (this.state.federates === true)) { + let baseUrl = this.state.user.split("@")[1]; + axios.get("https://" + baseUrl + "/api/v1/timelines/public").catch((err: Error) => { + let userInputError = true; + let userInputErrorMessage = "Instance name is invalid."; + this.setState({ userInputError, userInputErrorMessage }); + return true; + }); + } else if (this.state.user.includes(this.state.registerBase? this.state.registerBase: "mastodon.social")) { + this.setState({ userInputError, userInputErrorMessage }); + return false; + } else { + userInputError = true; + userInputErrorMessage = "You cannot sign in with this username."; this.setState({ userInputError, userInputErrorMessage }); return true; - }) + } } else { this.setState({ userInputError, userInputErrorMessage }); return false; } + this.setState({ userInputError, userInputErrorMessage }); return false; } From 3e2c40aaaec423b8a7cfa71cc5e4c8a7bd590d17 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 14:01:49 -0400 Subject: [PATCH 09/10] Moved override class to CSS classname and applied to links manually --- src/pages/Welcome.tsx | 14 ++++++++------ src/pages/WelcomePage.styles.tsx | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index e38b2aa..f9bbf91 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -297,7 +297,7 @@ class WelcomePage extends Component { { this.state.foundSavedLogin? - Signing in from a previous session? this.resumeLogin()}>Continue login. + Signing in from a previous session? this.resumeLogin()}>Continue login. : null } @@ -305,7 +305,6 @@ class WelcomePage extends Component {
- Having trouble signing in? this.startEmergencyLogin()}>Sign in with a code. + Having trouble signing in? this.startEmergencyLogin()} className={classes.welcomeLink}>Sign in with a code.
); } @@ -421,10 +420,13 @@ class WelcomePage extends Component {
- © {new Date().getFullYear()} {this.state.brandName && this.state.brandName !== "Hyperspace"? `${this.state.brandName} developers and the `: ""}Hyperspace developers. All rights reserved. + © {new Date().getFullYear()} {this.state.brandName && this.state.brandName !== "Hyperspace"? `${this.state.brandName} developers and the `: ""} Hyperspace developers. All rights reserved. - { this.state.repo? Source code | : null}License | File an Issue + { this.state.repo? + Source code | : null} + License | + File an Issue {this.state.brandName? this.state.brandName: "Hypersapce"} v.{this.state.version} {this.state.brandName && this.state.brandName !== "Hyperspace"? "(Hyperspace-like)": null} diff --git a/src/pages/WelcomePage.styles.tsx b/src/pages/WelcomePage.styles.tsx index 7839ca1..c7975ac 100644 --- a/src/pages/WelcomePage.styles.tsx +++ b/src/pages/WelcomePage.styles.tsx @@ -34,9 +34,9 @@ export const styles = (theme: Theme) => createStyles({ paddingRight: theme.spacing.unit * 4, paddingBottom: theme.spacing.unit * 6, textAlign: 'center', - '& a': { - color: theme.palette.primary.light - } + }, + welcomeLink: { + color: theme.palette.primary.light }, flexGrow: { flexGrow: 1 From 549cf39c7544a8c96affaca01012a7bb5cb47ebe Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 27 Apr 2019 19:15:50 -0400 Subject: [PATCH 10/10] Hide "Not from x?" message when defederated --- src/pages/Welcome.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index 7f51dc3..675c4a5 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -302,7 +302,7 @@ class WelcomePage extends Component { }
{ - this.state.registerBase? Not from {this.state.registerBase? this.state.registerBase: "noinstance"}? Sign in with your full username.: null + this.state.registerBase && this.state.federates? Not from {this.state.registerBase? this.state.registerBase: "noinstance"}? Sign in with your full username.: null }
{