hot fix: search page wip

This commit is contained in:
Sean Yesmunt 2019-06-19 20:57:51 -04:00
parent 3af8fa8ff8
commit c2861352a9
5 changed files with 55 additions and 18 deletions

View file

@ -6,6 +6,8 @@ import { history } from './store';
import ElectronCookies from '@exponent/electron-cookies';
// @endif
const isProduction = process.env.NODE_ENV === 'production';
type Analytics = {
pageView: string => void,
setUser: Object => void,
@ -61,18 +63,20 @@ const analytics: Analytics = {
}
},
apiLogSearch: () => {
if (analyticsEnabled) {
if (analyticsEnabled && isProduction) {
Lbryio.call('event', 'search');
}
},
apiLogPublish: () => {
if (analyticsEnabled) {
if (analyticsEnabled && isProduction) {
Lbryio.call('event', 'publish');
}
},
apiSearchFeedback: (query, vote) => {
// We don't need to worry about analytics enabled here because users manually click on the button to provide feedback
Lbryio.call('feedback', 'search', { query, vote });
if (isProduction) {
// We don't need to worry about analytics enabled here because users manually click on the button to provide feedback
Lbryio.call('feedback', 'search', { query, vote });
}
},
};

View file

@ -9,7 +9,7 @@ const select = state => ({
});
const perform = dispatch => ({
doSearch: query => doSearch(query),
search: query => dispatch(doSearch(query)),
onFeedbackPositive: query => {
analytics.apiSearchFeedback(query, 1);
dispatch(

View file

@ -9,7 +9,7 @@ import SearchOptions from 'component/searchOptions';
import Button from 'component/button';
type Props = {
doSearch: string => void,
search: string => void,
location: UrlLocation,
uris: Array<string>,
onFeedbackNegative: string => void,
@ -17,14 +17,8 @@ type Props = {
};
export default function SearchPage(props: Props) {
const {
doSearch,
uris,
onFeedbackPositive,
onFeedbackNegative,
location: { search },
} = props;
const urlParams = new URLSearchParams(search);
const { search, uris, onFeedbackPositive, onFeedbackNegative, location } = props;
const urlParams = new URLSearchParams(location.search);
const urlQuery = urlParams.get('q');
const isValid = isURIValid(urlQuery);
@ -35,9 +29,10 @@ export default function SearchPage(props: Props) {
useEffect(() => {
if (urlQuery) {
doSearch(urlQuery);
console.log('search', urlQuery);
search(urlQuery);
}
}, [doSearch, urlQuery]);
}, [search, urlQuery]);
return (
<Page>

View file

@ -1,7 +1,7 @@
.file-list__header {
display: flex;
align-items: center;
height: 4.5rem;
min-height: 4.5rem;
padding: var(--spacing-medium);
font-size: 1rem; // Ensures select & header text have same font-size
color: $lbry-white;
@ -24,6 +24,11 @@
color: $lbry-teal-1;
}
}
// Fix this in @lbry/components, we shouldn't need to be this specific
checkbox-element input[type='checkbox']:checked + label {
color: $lbry-white;
}
}
.file-list__header--small {

View file

@ -251,5 +251,38 @@
"Waiting for blob.": "Waiting for blob.",
"Waiting for metadata.": "Waiting for metadata.",
"Sorry, looks like we can't play this file.": "Sorry, looks like we can't play this file.",
"Sorry, looks like we can't preview this file.": "Sorry, looks like we can't preview this file."
"Sorry, looks like we can't preview this file.": "Sorry, looks like we can't preview this file.",
"Search For": "Search For",
"Files": "Files",
"Channels": "Channels",
"Everything": "Everything",
"File Types": "File Types",
"Videos": "Videos",
"Audio": "Audio",
"Images": "Images",
"Text": "Text",
"Other Files": "Other Files",
"Other Options": "Other Options",
"Returned Results": "Returned Results",
"Custom Code": "Custom Code",
"Are you a supermodel or rockstar that received a custom reward code? Claim it here.": "Are you a supermodel or rockstar that received a custom reward code? Claim it here.",
"Get": "Get",
"Go To Invites": "Go To Invites",
"Enter Code": "Enter Code",
"Reward history is tied to your email. In case of lost or multiple wallets, your balance may differ from the amounts claimed": "Reward history is tied to your email. In case of lost or multiple wallets, your balance may differ from the amounts claimed",
"Views": "Views",
"Edit": "Edit",
"Copied": "Copied",
"View": "View",
"Full screen (f)": "Full screen (f)",
"Fullscreen": "Fullscreen",
"The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it.": "The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it.",
"Checkout": "Checkout",
"the rewards page": "the rewards page",
"or send more LBC to your wallet.": "or send more LBC to your wallet.",
"Requesting stream...": "Requesting stream...",
"Connecting...": "Connecting...",
"Downloading stream... not long left now!": "Downloading stream... not long left now!",
"Downloading: ": "Downloading: ",
"% complete": "% complete"
}