hot fix: search page wip
This commit is contained in:
parent
3af8fa8ff8
commit
c2861352a9
5 changed files with 55 additions and 18 deletions
|
@ -6,6 +6,8 @@ import { history } from './store';
|
||||||
import ElectronCookies from '@exponent/electron-cookies';
|
import ElectronCookies from '@exponent/electron-cookies';
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
type Analytics = {
|
type Analytics = {
|
||||||
pageView: string => void,
|
pageView: string => void,
|
||||||
setUser: Object => void,
|
setUser: Object => void,
|
||||||
|
@ -61,18 +63,20 @@ const analytics: Analytics = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apiLogSearch: () => {
|
apiLogSearch: () => {
|
||||||
if (analyticsEnabled) {
|
if (analyticsEnabled && isProduction) {
|
||||||
Lbryio.call('event', 'search');
|
Lbryio.call('event', 'search');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apiLogPublish: () => {
|
apiLogPublish: () => {
|
||||||
if (analyticsEnabled) {
|
if (analyticsEnabled && isProduction) {
|
||||||
Lbryio.call('event', 'publish');
|
Lbryio.call('event', 'publish');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apiSearchFeedback: (query, vote) => {
|
apiSearchFeedback: (query, vote) => {
|
||||||
// We don't need to worry about analytics enabled here because users manually click on the button to provide feedback
|
if (isProduction) {
|
||||||
Lbryio.call('feedback', 'search', { 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 });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
doSearch: query => doSearch(query),
|
search: query => dispatch(doSearch(query)),
|
||||||
onFeedbackPositive: query => {
|
onFeedbackPositive: query => {
|
||||||
analytics.apiSearchFeedback(query, 1);
|
analytics.apiSearchFeedback(query, 1);
|
||||||
dispatch(
|
dispatch(
|
||||||
|
|
|
@ -9,7 +9,7 @@ import SearchOptions from 'component/searchOptions';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
doSearch: string => void,
|
search: string => void,
|
||||||
location: UrlLocation,
|
location: UrlLocation,
|
||||||
uris: Array<string>,
|
uris: Array<string>,
|
||||||
onFeedbackNegative: string => void,
|
onFeedbackNegative: string => void,
|
||||||
|
@ -17,14 +17,8 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function SearchPage(props: Props) {
|
export default function SearchPage(props: Props) {
|
||||||
const {
|
const { search, uris, onFeedbackPositive, onFeedbackNegative, location } = props;
|
||||||
doSearch,
|
const urlParams = new URLSearchParams(location.search);
|
||||||
uris,
|
|
||||||
onFeedbackPositive,
|
|
||||||
onFeedbackNegative,
|
|
||||||
location: { search },
|
|
||||||
} = props;
|
|
||||||
const urlParams = new URLSearchParams(search);
|
|
||||||
const urlQuery = urlParams.get('q');
|
const urlQuery = urlParams.get('q');
|
||||||
const isValid = isURIValid(urlQuery);
|
const isValid = isURIValid(urlQuery);
|
||||||
|
|
||||||
|
@ -35,9 +29,10 @@ export default function SearchPage(props: Props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (urlQuery) {
|
if (urlQuery) {
|
||||||
doSearch(urlQuery);
|
console.log('search', urlQuery);
|
||||||
|
search(urlQuery);
|
||||||
}
|
}
|
||||||
}, [doSearch, urlQuery]);
|
}, [search, urlQuery]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.file-list__header {
|
.file-list__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 4.5rem;
|
min-height: 4.5rem;
|
||||||
padding: var(--spacing-medium);
|
padding: var(--spacing-medium);
|
||||||
font-size: 1rem; // Ensures select & header text have same font-size
|
font-size: 1rem; // Ensures select & header text have same font-size
|
||||||
color: $lbry-white;
|
color: $lbry-white;
|
||||||
|
@ -24,6 +24,11 @@
|
||||||
color: $lbry-teal-1;
|
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 {
|
.file-list__header--small {
|
||||||
|
|
|
@ -251,5 +251,38 @@
|
||||||
"Waiting for blob.": "Waiting for blob.",
|
"Waiting for blob.": "Waiting for blob.",
|
||||||
"Waiting for metadata.": "Waiting for metadata.",
|
"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 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"
|
||||||
}
|
}
|
Loading…
Reference in a new issue