Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/components/appSearchSuper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import {useAppState} from '@stores/appState';
import {AutonomousSavedDialogList} from '@components/autonomousDialogList/savedDialogs';
import SetTransition from '@components/singleTransition';
import liteMode from '@helpers/liteMode';
import {wrapGlobalPostsSearch} from './sidebarLeft/globalPostsSearch';

// const testScroll = false;

Expand All @@ -128,7 +129,7 @@ export type SearchSuperContext = {

export type SearchSuperMediaType = 'stories' | 'members' | 'media' |
'files' | 'links' | 'music' | 'chats' | 'voice' | 'groups' | 'similar' |
'savedDialogs' | 'saved' | 'channels' | 'apps' | 'gifts';
'savedDialogs' | 'saved' | 'channels' | 'apps' | 'gifts' | 'posts';
export type SearchSuperMediaTab = {
inputFilter?: SearchSuperType,
name: LangPackKey,
Expand Down Expand Up @@ -2067,8 +2068,22 @@ export default class AppSearchSuper {
this.loaded[mediaTab.type] = true;
}

globalPostsSearch: ReturnType<typeof wrapGlobalPostsSearch>;
private async loadPosts({mediaTab, middleware}: SearchSuperLoadTypeOptions) {
if(!this.globalPostsSearch) {
this.globalPostsSearch = wrapGlobalPostsSearch({
middleware,
query: this.searchContext.query
});
mediaTab.contentTab.append(this.globalPostsSearch.dom);
}

this.globalPostsSearch.loadMore();
}

private loadGifts() {
const mediaTab = this.mediaTabsMap.get('gifts');
if(!mediaTab) return;

if(!this.stargiftsStore) {
const middleware = this.middleware.get();
Expand Down Expand Up @@ -2136,6 +2151,8 @@ export default class AppSearchSuper {
promise = this.loadChannels(options);
} else if(type === 'apps') {
promise = this.loadApps(options);
} else if(type === 'posts') {
promise = this.loadPosts(options);
}

if(promise) {
Expand Down Expand Up @@ -2699,6 +2716,7 @@ export default class AppSearchSuper {
this.membersParticipantMap = undefined;
this.membersMiddlewareHelper?.destroy();
this.membersMiddlewareHelper = undefined;
this.globalPostsSearch = undefined;
}

public cleanScrollPositions() {
Expand Down
66 changes: 66 additions & 0 deletions src/components/sidebarLeft/globalPostsSearch.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 20rem;
padding-inline: 1rem;
text-align: center;
text-wrap: balance;
}

.title {
font-size: var(--font-size-18);
line-height: var(--line-height-18);
font-weight: 500;
}

.description {
color: var(--secondary-text-color);
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}

.button {
height: 42px;
width: auto;
padding-inline: 1rem;
width: 240px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
gap: 0.25rem;
}

.buttonPaidSearch {
height: 46px;
flex-direction: column;
gap: 0;
}

.remainingUntilReset {
font-size: var(--font-size-13);
line-height: var(--line-height-13);
font-weight: 400;
opacity: 0.8;
}

.searchQuery {
opacity: 0.8;
overflow: hidden;
text-overflow: ellipsis;
}

.footer {
color: var(--secondary-text-color);
font-size: var(--font-size-14);
line-height: var(--line-height-14);
margin-top: 0.5rem;
}

.results {
padding: 0.5rem;
}
Loading