diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 062e39c..3d22bc9 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -14,7 +14,7 @@ import Post from "../components/Post"; import { Status } from "../types/Status"; import Mastodon, { StreamListener } from "megalodon"; import { withSnackbar } from "notistack"; -import Masonry from 'react-masonry-css' +import Masonry from "react-masonry-css"; import { getUserDefaultBool } from "../utilities/settings"; import ArrowUpwardIcon from "@material-ui/icons/ArrowUpward"; @@ -38,7 +38,7 @@ class HomePage extends Component { this.state = { viewIsLoading: true, backlogPosts: null, - isMasonryLayout: getUserDefaultBool('isMasonryLayout') + isMasonryLayout: getUserDefaultBool("isMasonryLayout") }; this.client = new Mastodon( @@ -159,9 +159,7 @@ class HomePage extends Component { render() { const { classes } = this.props; const containerClasses = `${classes.pageLayoutMaxConstraints}${ - this.state.isMasonryLayout - ? ' ' + classes.pageLayoutMasonry - : '' + this.state.isMasonryLayout ? " " + classes.pageLayoutMasonry : "" }`; return (
@@ -199,22 +197,26 @@ class HomePage extends Component { default: 4, 2000: 3, 1400: 2, - 1050: 1, + 1050: 1 }} className={classes.masonryGrid} - columnClassName={classes['my-masonry-grid_column']} - > - {this.state.posts.map((post: Status) => { - return ( -
- -
- ); - })} + columnClassName={ + classes["my-masonry-grid_column"] + } + > + {this.state.posts.map((post: Status) => { + return ( +
+ +
+ ); + })} ) : (
diff --git a/src/pages/Local.tsx b/src/pages/Local.tsx index 10094f8..258de32 100644 --- a/src/pages/Local.tsx +++ b/src/pages/Local.tsx @@ -14,7 +14,7 @@ import Post from "../components/Post"; import { Status } from "../types/Status"; import Mastodon, { StreamListener } from "megalodon"; import { withSnackbar } from "notistack"; -import Masonry from 'react-masonry-css'; +import Masonry from "react-masonry-css"; import { getUserDefaultBool } from "../utilities/settings"; import ArrowUpwardIcon from "@material-ui/icons/ArrowUpward"; @@ -38,7 +38,7 @@ class LocalPage extends Component { this.state = { viewIsLoading: true, backlogPosts: null, - isMasonryLayout: getUserDefaultBool('isMasonryLayout'), + isMasonryLayout: getUserDefaultBool("isMasonryLayout") }; this.client = new Mastodon( @@ -196,14 +196,18 @@ class LocalPage extends Component { default: 4, 2000: 3, 1400: 2, - 1050: 1, + 1050: 1 }} className={classes.masonryGrid} - columnClassName={classes['my-masonry-grid_column']} + columnClassName={ + classes["my-masonry-grid_column"] + } > {this.state.posts.map((post: Status) => { return ( -
+
{
{this.state.posts.map((post: Status) => { return ( -
+
marginTop: 88, padding: theme.spacing.unit * 3, paddingLeft: theme.spacing.unit * 16, - paddingRight: theme.spacing.unit * 16, + paddingRight: theme.spacing.unit * 16 }, [theme.breakpoints.up("lg")]: { marginLeft: 250, marginTop: 88, padding: theme.spacing.unit * 3, paddingLeft: theme.spacing.unit * 32, - paddingRight: theme.spacing.unit * 32, + paddingRight: theme.spacing.unit * 32 }, [theme.breakpoints.up("xl")]: { marginLeft: 250, marginTop: 88, padding: theme.spacing.unit * 3, paddingLeft: theme.spacing.unit * 40, - paddingRight: theme.spacing.unit * 40, + paddingRight: theme.spacing.unit * 40 }, backgroundColor: theme.palette.background.default, minHeight: isDarwinApp() ? "100vh" : "auto" @@ -326,13 +326,14 @@ export const styles = (theme: Theme) => }, pageLayoutMasonry: { paddingLeft: theme.spacing.unit * 3, - paddingRight: theme.spacing.unit * 3, + paddingRight: theme.spacing.unit * 3 }, masonryGrid: { - display: 'flex', - width: 'auto', - }, - 'my-masonry-grid_column': { // non-standard name fixes react-masonry-css bug :shrug: - padding: 5, + display: "flex", + width: "auto" }, + "my-masonry-grid_column": { + // non-standard name fixes react-masonry-css bug :shrug: + padding: 5 + } }); diff --git a/src/pages/Public.tsx b/src/pages/Public.tsx index faa022f..1fd3106 100644 --- a/src/pages/Public.tsx +++ b/src/pages/Public.tsx @@ -14,7 +14,7 @@ import Post from "../components/Post"; import { Status } from "../types/Status"; import Mastodon, { StreamListener } from "megalodon"; import { withSnackbar } from "notistack"; -import Masonry from 'react-masonry-css'; +import Masonry from "react-masonry-css"; import { getUserDefaultBool } from "../utilities/settings"; import ArrowUpwardIcon from "@material-ui/icons/ArrowUpward"; @@ -25,7 +25,7 @@ interface IPublicPageState { viewDidLoad?: boolean; viewDidError?: boolean; viewDidErrorCode?: any; - isMasonryLayout?:boolean; + isMasonryLayout?: boolean; } class PublicPage extends Component { @@ -38,7 +38,7 @@ class PublicPage extends Component { this.state = { viewIsLoading: true, backlogPosts: null, - isMasonryLayout: getUserDefaultBool('isMasonryLayout') + isMasonryLayout: getUserDefaultBool("isMasonryLayout") }; this.client = new Mastodon( @@ -195,14 +195,18 @@ class PublicPage extends Component { default: 4, 2000: 3, 1400: 2, - 1050: 1, + 1050: 1 }} className={classes.masonryGrid} - columnClassName={classes['my-masonry-grid_column']} + columnClassName={ + classes["my-masonry-grid_column"] + } > {this.state.posts.map((post: Status) => { return ( -
+
{
{this.state.posts.map((post: Status) => { return ( -
+
{ brandName: "Hyperspace", federated: true, imposeCharacterLimit: getUserDefaultBool("imposeCharacterLimit"), - masonryLayout: getUserDefaultBool("isMasonryLayout"), + masonryLayout: getUserDefaultBool("isMasonryLayout") }; this.toggleDarkMode = this.toggleDarkMode.bind(this); @@ -129,7 +129,7 @@ class SettingsPage extends Component { this.toggleBadgeCount = this.toggleBadgeCount.bind(this); this.toggleThemeDialog = this.toggleThemeDialog.bind(this); this.toggleVisibilityDialog = this.toggleVisibilityDialog.bind(this); - this.toggleMasonryLayout = this.toggleMasonryLayout.bind(this) + this.toggleMasonryLayout = this.toggleMasonryLayout.bind(this); this.changeThemeName = this.changeThemeName.bind(this); this.changeTheme = this.changeTheme.bind(this); this.setVisibility = this.setVisibility.bind(this); @@ -246,11 +246,8 @@ class SettingsPage extends Component { } toggleMasonryLayout() { - this.setState({ masonryLayout: !this.state.masonryLayout }) - setUserDefaultBool( - "isMasonryLayout", - !this.state.masonryLayout - ) + this.setState({ masonryLayout: !this.state.masonryLayout }); + setUserDefaultBool("isMasonryLayout", !this.state.masonryLayout); } changeTheme() { diff --git a/src/utilities/settings.tsx b/src/utilities/settings.tsx index 93be298..b71d1a2 100644 --- a/src/utilities/settings.tsx +++ b/src/utilities/settings.tsx @@ -102,7 +102,7 @@ export function createUserDefaults() { displayAllOnNotificationBadge: false, defaultVisibility: "public", imposeCharacterLimit: true, - isMasonryLayout: false, + isMasonryLayout: false }; let settings = [ @@ -112,7 +112,7 @@ export function createUserDefaults() { "displayAllOnNotificationBadge", "defaultVisibility", "imposeCharacterLimit", - "isMasonryLayout", + "isMasonryLayout" ]; migrateExistingSettings();