Compare commits

...

44 Commits

Author SHA1 Message Date
Jason Frerich
51425f9bb5 remove dir 2022-08-09 13:24:21 -05:00
Jason Frerich
49b2a332e5 Merge branch 'gekidou' into recent-searches-for-navigation 2022-08-09 13:22:40 -05:00
Jason Frerich
14bd424d18 debuggin 2022-07-10 15:39:29 -05:00
Jason Frerich
e13e2a618d remove the backgroundcolors 2022-07-10 14:54:47 -05:00
Jason Frerich
b6fc5abf92 add color to all component backgrounds 2022-07-07 22:10:37 -05:00
Jason Frerich
423b405e4f set the max searches saved to 15 2022-07-07 20:50:53 -05:00
Jason Frerich
5b36199976 when not useing the onScroll callback you don't need to set the
scrollEventThrottle
2022-07-07 19:26:32 -05:00
Jason Frerich
0094fc9a32 call destroyPermanently directly 2022-07-07 19:22:58 -05:00
Jason Frerich
7902483072 There is only one record, so no need to batch. Just call
destroyPermanently.
2022-07-07 18:53:20 -05:00
Jason Frerich
1232cf45d8 remove surrounding parenthesis 2022-07-07 18:30:24 -05:00
Jason Frerich
91525b6eb0 use logError instead of console.log and trowing an error 2022-07-07 18:19:53 -05:00
Jason Frerich
a3bece2776 increase close button to touchable area of 40x40 and adjust menuitem
container
2022-07-06 16:18:04 -05:00
Jason Frerich
2afe6fb9d6 update styling from UX PR requests 2022-07-06 15:33:01 -05:00
Jason Frerich
fe042bf53c update divider opacity to match figma design 2022-07-06 13:45:16 -05:00
Jason Frerich
58370c48cc update compassIcon to match figma design 2022-07-06 13:42:52 -05:00
Jason Frerich
20f262af8d divider takes up 1ox so only need 15px margin to get the 16px total to
the neighboring veritcal views
2022-07-06 13:40:21 -05:00
Jason Frerich
a15e76bf3c styling changes 2022-07-06 13:37:39 -05:00
Jason Frerich
6a03482406 styling adjustments 2022-07-06 13:33:17 -05:00
Jason Frerich
27ef5838b4 - remove useMemo of recent
- set or remove props on AnimatedFlatlist
2022-07-06 13:16:28 -05:00
Jason Frerich
eb01ec1368 remove unused function 2022-07-06 12:59:24 -05:00
Jason Frerich
cca1e160f6 always update the created_at value in the database. 2022-07-06 12:51:39 -05:00
Jason Frerich
f1b05cfcae move styles to the top 2022-07-06 11:47:15 -05:00
Jason Frerich
26904aa9e5 extract as constant 2022-07-06 11:39:53 -05:00
Jason Frerich
678d3ed711 clean up 2022-07-02 14:56:13 -05:00
Jason Frerich
3df715644c clean up 2022-07-02 14:55:25 -05:00
Jason Frerich
13652dfe2d set display to term for now 2022-07-02 14:45:46 -05:00
Jason Frerich
efc6cb8cc8 limit the number of saved searches to 20 for a team.
return the results a team Search History sorted by createdAt
2022-07-02 14:22:03 -05:00
Elias Nahum
c4d2ffe347 Fix android autoscroll search field to the top 2022-07-02 11:05:49 -04:00
Elias Nahum
e6932781b3 fix eslint 2022-07-02 11:01:10 -04:00
Elias Nahum
e134941de8 Fix search to use a flatlist and remove douplicate reference 2022-07-02 10:58:57 -04:00
Jason Frerich
8b7a9b32b1 s/addRecentTeamSearch/addSearchToTeamSearchHistory/ 2022-07-02 09:33:08 -05:00
Jason Frerich
bd87d80baf s/deleteRecentTeamSearchById/removeSearchFromTeamSearchHistory/ 2022-07-02 09:27:27 -05:00
Elias Nahum
3752f9a516 use flatlist instead of scrolview 2022-07-01 18:45:15 -04:00
Jason Frerich
cd16ec6308 push for scrollview 2022-07-01 16:36:49 -05:00
Jason Frerich
7429f4799f will now add new ters to the table and recreate existing terms with new
timestamp
2022-07-01 12:36:09 -05:00
Jason Frerich
501e03647a can delete recent searches from WDB from recent searches Options 2022-07-01 01:23:58 -05:00
Jason Frerich
809a18a87d search terms from the search bar are getting added 2022-06-30 23:01:55 -05:00
Jason Frerich
64a2d21a73 recent search are getting rendered from WDB 2022-06-30 22:45:02 -05:00
Jason Frerich
1eaecfcc8e Merge branch 'gekidou' into MM-44927-recent-searches 2022-06-30 13:59:54 -05:00
Jason Frerich
f79ae62ead initial commit 2022-06-17 09:26:52 -05:00
Jason Frerich
77eb6774c9 UI adjustments from PR feedback 2022-06-16 14:54:47 -05:00
Jason Frerich
a8250ec8af ignore the back press 2022-06-16 10:44:48 -05:00
Jason Frerich
fd3dea386d add search value to memoized dependencies in modifier component 2022-06-16 10:31:55 -05:00
Jason Frerich
f1f1fa5484 initial check in 2022-06-15 12:34:40 -05:00
11 changed files with 112 additions and 21 deletions

View File

@@ -47,19 +47,23 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
},
container: {
alignItems: 'center',
backgroundColor: theme.sidebarBg,
backgroundColor: 'red',
// backgroundColor: theme.sidebarBg,
flexDirection: 'row',
justifyContent: 'flex-start',
paddingHorizontal: 16,
zIndex: 10,
},
subtitleContainer: {
backgroundColor: 'purple',
flexDirection: 'row',
justifyContent: Platform.select({android: 'flex-start', ios: 'center'}),
left: Platform.select({ios: undefined, default: 3}),
},
subtitle: {
color: changeOpacity(theme.sidebarHeaderTextColor, 0.72),
backgroundColor: 'green',
...typography('Body', 75),
lineHeight: 12,
marginBottom: 8,
@@ -68,6 +72,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
},
titleContainer: {
alignItems: Platform.select({android: 'flex-start', ios: 'center'}),
backgroundColor: 'purple',
justifyContent: 'center',
flex: 3,
height: '100%',
@@ -166,6 +171,7 @@ const Header = ({
const containerStyle = useMemo(() => {
return [styles.container, {height: defaultHeight + top, paddingTop: top}];
}, [defaultHeight, theme]);
console.log('containerStyle', containerStyle);
const additionalTitleStyle = useMemo(() => ({
marginLeft: Platform.select({android: showBackButton && !leftComponent ? 20 : 0}),
@@ -194,7 +200,7 @@ const Header = ({
</TouchableWithFeedback>
</Animated.View>
}
<Animated.View style={[styles.titleContainer, additionalTitleStyle]}>
<Animated.View style={[additionalTitleStyle]}>
<TouchableWithFeedback
disabled={!onTitlePress}
onPress={onTitlePress}

View File

@@ -32,7 +32,10 @@ type Props = SearchProps & {
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
container: {
backgroundColor: theme.sidebarBg,
backgroundColor: 'brown',
// backgroundColor: theme.sidebarBg,
position: 'absolute',
width: '100%',
zIndex: 10,
@@ -69,6 +72,7 @@ const NavigationHeader = ({
maxHeight: largeHeight + insets.top + MAX_OVERSCROLL,
};
});
console.log('containerHeight.value', containerHeight.value);
return (
<>

View File

@@ -20,6 +20,8 @@ type Props = {
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
container: {
// backgroundColor: 'green',
backgroundColor: theme.sidebarBg,
paddingHorizontal: 20,
},
@@ -53,6 +55,10 @@ const NavigationHeaderLargeTitle = ({
const containerStyle = useMemo(() => {
return [{height: largeHeight - defaultHeight}, styles.container];
// const height = largeHeight - defaultHeight;
//
// return [{height}, styles.container];
}, [defaultHeight, largeHeight, theme]);
return (

View File

@@ -24,6 +24,8 @@ const INITIAL_TOP = -45;
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
container: {
// backgroundColor: 'purple',
backgroundColor: theme.sidebarBg,
height: HEADER_SEARCH_HEIGHT,
justifyContent: 'center',

View File

@@ -9,13 +9,15 @@ import {makeStyleSheetFromTheme} from '@utils/theme';
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
container: {
backgroundColor: theme.sidebarBg,
// backgroundColor: 'blue',
height: 40,
width: '100%',
position: 'absolute',
},
content: {
backgroundColor: theme.centerChannelBg,
// backgroundColor: 'blue',
borderTopLeftRadius: 12,
borderTopRightRadius: 12,
flex: 1,

View File

@@ -123,7 +123,7 @@ export const transformTeamSearchHistoryRecord = ({action, database, value}: Tran
const fieldsMapper = (teamSearchHistory: TeamSearchHistoryModel) => {
teamSearchHistory._raw.id = isCreateAction ? (teamSearchHistory.id) : record.id;
teamSearchHistory.createdAt = raw.created_at;
teamSearchHistory.createdAt = Date.now();
teamSearchHistory.displayTerm = raw.display_term;
teamSearchHistory.term = raw.term;
teamSearchHistory.teamId = raw.team_id;

View File

@@ -34,6 +34,26 @@ export const useDefaultHeaderHeight = () => {
export const useLargeHeaderHeight = () => {
const defaultHeight = useDefaultHeaderHeight();
return defaultHeight + ViewConstants.LARGE_HEADER_TITLE + ViewConstants.HEADER_WITH_SUBTITLE;
// const defaultHeight + ViewConstants.LARGE_HEADER_TITLE + ViewConstants.HEADER_WITH_SUBTITLE;
// const defaultHeight = useDefaultHeaderHeight();
// let defaultHeight = useDefaultHeaderHeight();
// if (showTitle) {
// defaultHeight += ViewConstants.LARGE_HEADER_TITLE;
// }
//
// if (hasSubTitle) {
// defaultHeight += ViewConstants.HEADER_WITH_SUBTITLE;
// }
// if (hasSearch) {
// defaultHeight += ViewConstants.HEADER_SEARCH_HEIGHT;
// }
// return defaultHeight;
// return defaultHeight + ViewConstants.LARGE_HEADER_TITLE + ViewConstants.HEADER_WITH_SUBTITLE;
};
export const useHeaderHeight = () => {
@@ -47,7 +67,11 @@ export const useHeaderHeight = () => {
}, [defaultHeight, largeHeight]);
};
export const useCollapsibleHeader = <T>(isLargeTitle: boolean, onSnap?: (offset: number) => void) => {
export const useCollapsibleHeader = <T>(
isLargeTitle: boolean,
onSnap?:
(offset: number) => void,
) => {
const insets = useSafeAreaInsets();
const animatedRef = useAnimatedRef<Animated.ScrollView>();
const {largeHeight, defaultHeight} = useHeaderHeight();
@@ -60,8 +84,16 @@ export const useCollapsibleHeader = <T>(isLargeTitle: boolean, onSnap?: (offset:
const value = -(scrollValue?.value || 0);
const header = (isLargeTitle ? largeHeight : defaultHeight);
const height = header + value + insets.top;
// console.log('-- height', height);
// console.log('-- header', header);
if (height > header + (insets.top * 2)) {
return Math.min(height, largeHeight + insets.top + MAX_OVERSCROLL);
// const returnMin = Math.min(height, largeHeight + MAX_OVERSCROLL);
// const returnMin = Math.min(height, largeHeight + insets.top + MAX_OVERSCROLL);
// console.log('-- XXX returnMin', returnMin);
// return returnMin;
}
return Math.max(height, minHeight);
});
@@ -122,6 +154,7 @@ export const useCollapsibleHeader = <T>(isLargeTitle: boolean, onSnap?: (offset:
const hideHeader = useCallback(() => {
const offset = largeHeight - defaultHeight;
if (animatedRef?.current && Math.abs((scrollValue?.value || 0)) <= insets.top) {
console.log('\n\nIN HIDE HEADER\n\n');
autoScroll.value = true;
if ('scrollTo' in animatedRef.current) {
animatedRef.current.scrollTo({y: offset, animated: true});
@@ -136,9 +169,17 @@ export const useCollapsibleHeader = <T>(isLargeTitle: boolean, onSnap?: (offset:
}
}, [largeHeight, defaultHeight]);
// const scrollPaddingTop = (isLargeTitle ? largeHeight : defaultHeight) + insets.top;
// console.log('<><> scrollPaddingTop', scrollPaddingTop);
// console.log('<><> scrollValue', scrollValue);
// console.log('<><> headerHeight', headerHeight);
return {
defaultHeight,
largeHeight,
// scrollPaddingTop,
scrollPaddingTop: (isLargeTitle ? largeHeight : defaultHeight) + insets.top,
scrollRef: animatedRef as unknown as React.RefObject<T>,
scrollValue,

View File

@@ -20,10 +20,9 @@ import Account from './account';
import ChannelList from './channel_list';
import RecentMentions from './recent_mentions';
import SavedMessages from './saved_messages';
import Search from './search';
import TabBar from './tab_bar';
// import Search from './search';
import type {LaunchProps} from '@typings/launch';
if (Platform.OS === 'ios') {
@@ -102,6 +101,8 @@ export default function HomeScreen(props: HomeProps) {
dark: false,
colors: {
primary: theme.centerChannelColor,
// background: 'yellow',
background: 'transparent',
card: theme.centerChannelBg,
text: theme.centerChannelColor,
@@ -125,11 +126,11 @@ export default function HomeScreen(props: HomeProps) {
>
{() => <ChannelList {...props}/>}
</Tab.Screen>
{/* <Tab.Screen
<Tab.Screen
name={Screens.SEARCH}
component={Search}
options={{unmountOnBlur: false, lazy: true, tabBarTestID: 'tab_bar.search.tab'}}
/> */}
/>
<Tab.Screen
name={Screens.MENTIONS}
component={RecentMentions}

View File

@@ -116,7 +116,7 @@ const Modifiers = ({searchValue, setSearchValue, setTeamId, teamId}: Props) => {
<>
<View style={styles.titleContainer}>
<FormattedText
style={styles.title}
style={[styles.title, {backgroundColor: 'cyan'}]}
id={'screen.search.modifier.header'}
defaultMessage='Search options'
/>

View File

@@ -251,7 +251,7 @@ const SearchResults = ({
indicatorStyle='black'
refreshing={false}
renderItem={renderItem}
contentContainerStyle={paddingTop}
contentContainerStyle={[paddingTop, {backgroundColor: 'cyan'}]}
nestedScrollEnabled={true}
removeClippedSubviews={true}
style={containerStyle}

View File

@@ -68,7 +68,6 @@ const SearchScreen = ({teamId}: Props) => {
const isFocused = useIsFocused();
const intl = useIntl();
const theme = useTheme();
const stateIndex = nav.getState().index;
const serverUrl = useServerUrl();
const searchTerm = (nav.getState().routes[stateIndex].params as any)?.searchTerm;
@@ -87,8 +86,7 @@ const SearchScreen = ({teamId}: Props) => {
const [fileInfos, setFileInfos] = useState<FileInfo[]>(emptyFileResults);
const [fileChannelIds, setFileChannelIds] = useState<string[]>([]);
const onSnap = (offset: number) => {
scrollRef.current?.scrollToOffset({offset, animated: true});
// hideHeader();
};
const {scrollPaddingTop, scrollRef, scrollValue, onScroll, headerHeight, hideHeader} = useCollapsibleHeader<FlatList>(true, onSnap);
@@ -138,6 +136,7 @@ const SearchScreen = ({teamId}: Props) => {
}, [handleSearch, handleTextChange, searchTeamId]);
const handleFilterChange = useCallback(async (filterValue: FileFilter) => {
console.log('--- handleFilterChange --- ');
setLoading(true);
setFilter(filterValue);
const searchParams = getSearchParams(lastSearchedValue, filterValue);
@@ -247,12 +246,41 @@ const SearchScreen = ({teamId}: Props) => {
/>
), [cursorPosition, handleTextChange, searchValue]);
return (
<FreezeScreen freeze={!isFocused}>
// console.log('showResults', showResults);
// console.log('loading', loading);
// if (showResults && !loading) {
if (lastSearchedValue && !loading) {
return (
<Header
onTabSelect={setSelectedTab}
onFilterChanged={handleFilterChange}
numberMessages={postIds.length}
selectedTab={selectedTab}
numberFiles={fileInfos.length}
selectedFilter={filter}
/>
);
}
// }
}, [loading, lastSearchedValue, selectedTab]);
const renderNavigationHeader = useMemo(() => {
console.log('--- RERENDER renderNavigationHeader ---');
const title = showResults ? undefined : intl.formatMessage({id: 'screen.search.title', defaultMessage: 'Search'});
console.log('\n');
// console.log('<><>title', title);
// console.log('<><>scrollValue', scrollValue);
// console.log('<><>searchValue', searchValue);
// console.log('<><>onSubmit', onSubmit);
return (
<NavigationHeader
isLargeTitle={true}
showBackButton={false}
title={intl.formatMessage({id: 'screen.search.title', defaultMessage: 'Search'})}
title={title}
hasSearch={true}
scrollValue={scrollValue}
hideHeader={hideHeader}
@@ -272,9 +300,10 @@ const SearchScreen = ({teamId}: Props) => {
edges={EDGES}
>
<Animated.View style={animated}>
<Animated.View style={top}>
{/* <Animated.View style={[{backgroundColor: 'cyan'}, top]}> */}
<Animated.View style={[top]}>
<RoundedHeaderContext/>
{header}
{showResults && renderResultsHeader()}
</Animated.View>
<AnimatedFlatList
data={dummyData}