diff --git a/src/js/Helpers.tsx b/src/js/Helpers.tsx index e98e3904..bb202c0e 100644 --- a/src/js/Helpers.tsx +++ b/src/js/Helpers.tsx @@ -13,8 +13,8 @@ import { language, translate as t } from './translations/Translation'; const emojiRegex = /([\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]+)/gu; -const pubKeyRegex = /(?:^|\s)(?:@)?(npub[a-zA-Z0-9]{59,60})(?![\w\/])/g; -const noteRegex = /(?:^|\s)(?:@)?(note[a-zA-Z0-9]{59,60})(?![\w\/])/g; +const pubKeyRegex = /(?:^|\s)(?:@)?(npub[a-zA-Z0-9]{59,60})(?![\w/])/g; +const noteRegex = /(?:^|\s)(?:@)?(note[a-zA-Z0-9]{59,60})(?![\w/])/g; function setImgSrc(el: JQuery, src: string): JQuery { if (src) { diff --git a/src/js/Nostr.ts b/src/js/Nostr.ts index e0f7eec7..dab6f4d9 100644 --- a/src/js/Nostr.ts +++ b/src/js/Nostr.ts @@ -910,7 +910,9 @@ const Nostr = { } } if (event.pubkey === myPub && event.tags.length) { - iris.local().get('noFollows').put(false); + if (this.followedByUser.get(myPub)?.size > 10) { + iris.local().get('showFollowSuggestions').put(false); + } } if (event.pubkey === myPub && event.content?.length) { try { diff --git a/src/js/components/OnboardingNotification.js b/src/js/components/OnboardingNotification.js index c70f46a6..5dcbca0d 100644 --- a/src/js/components/OnboardingNotification.js +++ b/src/js/components/OnboardingNotification.js @@ -6,6 +6,7 @@ import Helpers from '../Helpers'; import Nostr from '../Nostr'; import { translate as t } from '../translations/Translation'; +import Button from './basic/Button'; import CopyButton from './CopyButton'; import FollowButton from './FollowButton'; import Identicon from './Identicon'; @@ -15,11 +16,11 @@ export default class OnboardingNotification extends Component { componentDidMount() { iris.local().get('noFollowers').on(this.inject()); iris.local().get('hasNostrFollowers').on(this.inject()); - iris.local().get('noFollows').on(this.inject()); + iris.local().get('showFollowSuggestions').on(this.inject()); } render() { - if (this.state.noFollows) { + if (this.state.showFollowSuggestions) { return html`
@@ -36,6 +37,11 @@ export default class OnboardingNotification extends Component {
`, )} +

+ <${Button} onClick=${() => iris.local().get('showFollowSuggestions').put(false)}> + ${t('done')} + +

${t('alternatively')} { - const href = $(e.target).attr('href'); - if (href && href.indexOf('https://iris.to/') === 0) { - e.preventDefault(); - window.location = href.replace('https://iris.to/', ''); - } - }); - this.linksDone = true; - } - } - onClickName(e) { e.stopPropagation(); route(`/${this.state.msg.info.from}`); @@ -229,7 +213,6 @@ class PublicMessage extends Message { boostBtnClicked() { if (!this.state.boosted) { const author = this.state.msg?.event?.pubkey; - const nostrId = Nostr.toNostrHexAddress(this.props.hash); if (nostrId) { Nostr.publish({ diff --git a/src/js/components/SearchBox.tsx b/src/js/components/SearchBox.tsx index 15bd395e..6b9c7ebc 100644 --- a/src/js/components/SearchBox.tsx +++ b/src/js/components/SearchBox.tsx @@ -39,7 +39,7 @@ type ResultItem = { type State = { results: Array; query: string; - noFollows: boolean; + showFollowSuggestions: boolean; offsetLeft: number; selected: number; }; @@ -50,7 +50,7 @@ class SearchBox extends Component { this.state = { results: [], query: '', - noFollows: true, + showFollowSuggestions: true, offsetLeft: 0, selected: -1, // -1 - 'search by keyword' }; @@ -77,7 +77,7 @@ class SearchBox extends Component { } componentDidMount() { - iris.local().get('noFollows').on(this.inject()); + iris.local().get('showFollowSuggestions').on(this.inject()); iris .local() .get('searchIndexUpdated') diff --git a/src/js/views/Login.jsx b/src/js/views/Login.jsx index a7e8e8f5..ab800676 100644 --- a/src/js/views/Login.jsx +++ b/src/js/views/Login.jsx @@ -114,6 +114,7 @@ class Login extends Component { e.preventDefault(); let name = document.getElementById('login-form-name').value; iris.session.loginAsNewUser({ name, autofollow: false }); + iris.local().get('showFollowSuggestions').put(true); name && setTimeout(() => { Nostr.setMetadata({ name }); }, 100);