forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Glitch] Convert Home timeline components to Typescript
Port a75138d to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
- Loading branch information
1 parent
177497b
commit 447ab7a
Showing
7 changed files
with
153 additions
and
105 deletions.
There are no files selected for viewing
54 changes: 0 additions & 54 deletions
54
app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx
This file was deleted.
Oops, something went wrong.
104 changes: 104 additions & 0 deletions
104
app/javascript/flavours/glitch/features/home_timeline/components/column_settings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call, | ||
@typescript-eslint/no-unsafe-return, | ||
@typescript-eslint/no-unsafe-assignment, | ||
@typescript-eslint/no-unsafe-member-access | ||
-- the settings store is not yet typed */ | ||
import { useCallback } from 'react'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import SettingText from 'flavours/glitch/components/setting_text'; | ||
import { useAppSelector, useAppDispatch } from 'flavours/glitch/store'; | ||
|
||
import { changeSetting } from '../../../actions/settings'; | ||
import SettingToggle from '../../notifications/components/setting_toggle'; | ||
|
||
export const ColumnSettings: React.FC = () => { | ||
const settings = useAppSelector((state) => state.settings.get('home')); | ||
|
||
const dispatch = useAppDispatch(); | ||
const onChange = useCallback( | ||
(key: string, checked: boolean) => { | ||
void dispatch(changeSetting(['home', ...key], checked)); | ||
}, | ||
[dispatch], | ||
); | ||
|
||
return ( | ||
<div> | ||
<span className='column-settings__section'> | ||
<FormattedMessage | ||
id='home.column_settings.basic' | ||
defaultMessage='Basic' | ||
/> | ||
</span> | ||
|
||
<div className='column-settings__row'> | ||
<SettingToggle | ||
prefix='home_timeline' | ||
settings={settings} | ||
settingPath={['shows', 'reblog']} | ||
onChange={onChange} | ||
label={ | ||
<FormattedMessage | ||
id='home.column_settings.show_reblogs' | ||
defaultMessage='Show boosts' | ||
/> | ||
} | ||
/> | ||
</div> | ||
|
||
<div className='column-settings__row'> | ||
<SettingToggle | ||
prefix='home_timeline' | ||
settings={settings} | ||
settingPath={['shows', 'reply']} | ||
onChange={onChange} | ||
label={ | ||
<FormattedMessage | ||
id='home.column_settings.show_replies' | ||
defaultMessage='Show replies' | ||
/> | ||
} | ||
/> | ||
</div> | ||
|
||
<div className='column-settings__row'> | ||
<SettingToggle | ||
prefix='home_timeline' | ||
settings={settings} | ||
settingPath={['shows', 'direct']} | ||
onChange={onChange} | ||
label={ | ||
<FormattedMessage | ||
id='home.column_settings.show_direct' | ||
defaultMessage='Show private mentions' | ||
/> | ||
} | ||
/> | ||
</div> | ||
|
||
<span className='column-settings__section'> | ||
<FormattedMessage | ||
id='home.column_settings.advanced' | ||
defaultMessage='Advanced' | ||
/> | ||
</span> | ||
|
||
<div className='column-settings__row'> | ||
<SettingText | ||
prefix='home_timeline' | ||
settings={settings} | ||
settingPath={['regex', 'body']} | ||
onChange={onChange} | ||
label={ | ||
<FormattedMessage | ||
id='home.column_settings.filter_regex' | ||
defaultMessage='Filter out by regular expressions' | ||
/> | ||
} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; |
25 changes: 0 additions & 25 deletions
25
app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.jsx
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { Link } from 'react-router-dom'; | ||
|
||
import { DismissableBanner } from 'flavours/glitch/components/dismissable_banner'; | ||
import background from 'mastodon/../images/friends-cropped.png'; | ||
|
||
export const ExplorePrompt = () => ( | ||
<DismissableBanner id='home.explore_prompt'> | ||
<img | ||
src={background} | ||
alt='' | ||
className='dismissable-banner__background-image' | ||
/> | ||
|
||
<h1> | ||
<FormattedMessage | ||
id='home.explore_prompt.title' | ||
defaultMessage='This is your home base within Mastodon.' | ||
/> | ||
</h1> | ||
<p> | ||
<FormattedMessage | ||
id='home.explore_prompt.body' | ||
defaultMessage="Your home feed will have a mix of posts from the hashtags you've chosen to follow, the people you've chosen to follow, and the posts they boost. It's looking pretty quiet right now, so how about:" | ||
/> | ||
</p> | ||
|
||
<div className='dismissable-banner__message__wrapper'> | ||
<div className='dismissable-banner__message__actions'> | ||
<Link to='/explore' className='button'> | ||
<FormattedMessage | ||
id='home.actions.go_to_explore' | ||
defaultMessage="See what's trending" | ||
/> | ||
</Link> | ||
<Link to='/explore/suggestions' className='button button-tertiary'> | ||
<FormattedMessage | ||
id='home.actions.go_to_suggestions' | ||
defaultMessage='Find people to follow' | ||
/> | ||
</Link> | ||
</div> | ||
</div> | ||
</DismissableBanner> | ||
); |
23 changes: 0 additions & 23 deletions
23
...javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters