[WIP]Memex results alongside google search#323
[WIP]Memex results alongside google search#323subrat-sahu wants to merge 7 commits intoWorldBrain:masterfrom
Conversation
|
@oliversauter @poltak Please review the work done until now . |
fe1c75d to
521aaf6
Compare
poltak
left a comment
There was a problem hiding this comment.
This is pretty amazing stuff @subrat-sahu ! Genuinely impressed at how quick you got this working and in a very elegant way! And pretty much no changes to existing code.
All the view stuff will change according to the updated designs, so ignored that stuff. But the rest of the code is pretty high quality; no big issues I can see.
Adding react to the content script is probably gonna boost up the size, but it's not really a major issue as this isn't a website - it's a web extension. Maybe a future enhancement could be write this UI in one of those super tiny UI libs.
May also be nice to add some JSDoc with type info to the main functions you export from your modules. Becomes a lot easier for future devs to use without looking at the code then
Awesome work so far!
| } | ||
| }) | ||
|
|
||
| async function openOverviewPagewithParams(queryParams) { |
There was a problem hiding this comment.
There's a openOverview function in src/background module. Maybe you could integrate the queryParams param into that one and import here for re-use.
| const fetchSearchInjection = remoteFunction('fetchSearchInjection') | ||
|
|
||
| // Render Memex search results to the Google Search Page | ||
| const getCmdMessageHandler = ({ cmd, ...payload }) => { |
There was a problem hiding this comment.
This will all be much simpler once we get issue #288 finished :) then just call a function rather than have the port setup.
| } | ||
| } | ||
|
|
||
| handleShowMoreResults = () => { |
There was a problem hiding this comment.
verb handle usually reserved for methods/prop fns that will be used as event listeners. Any method that returns JSX generally begins with the verb render, hence render methods.
| SEARCH_INJECTION_KEY, | ||
| ) | ||
| // For old browsers do typeof searchInjection === "undefined" | ||
| if (searchInjection === undefined) { |
There was a problem hiding this comment.
You can supply a default value like browser.storage.local.get({ [SEARCH_INJECTION_KEY]: true }) then you just need to return that value. Shouldn't be a need to call storeSearchInjection if it's not defined yet.
There was a problem hiding this comment.
@poltak I need to make the store the function more generalised so i can use it to store more variables so I will change it any ways
| export async function toggleSearchInjection() { | ||
| const searchInjection = await fetchSearchInjection() | ||
| const value = searchInjection === false | ||
| return await storeSearchInjection(value) |
There was a problem hiding this comment.
More conventional way to toggle is just go storeSearchInjection(!searchInjection). ! operator will do the inversion for your with an explicit comparison needed
| // Temporary placement of this functions | ||
| browser.runtime.onMessage.addListener(value => { | ||
| switch (value.action) { | ||
| case 'openOverviewPagewithParams': |
There was a problem hiding this comment.
Might as well define this in the constants module; used in multiple places
|
|
||
| render() { | ||
| return ( | ||
| <Wrapper> |
There was a problem hiding this comment.
No need for <Wrapper> here. This component renders no DOM, it's just used to allow placement of sibling JSX elements without an explicitly defined parent.
| } | ||
|
|
||
| async handleToggle(event) { | ||
| await toggleSearchInjection() |
There was a problem hiding this comment.
why not just have toggleSearchInjection return the updated value? Not super important, but saves a remote call
521aaf6 to
63b2249
Compare
|
@oliversauter can you please check, that are the requirements fulfilled ! |
|
Good stuff, works except for a couple of things :) A few things we still need to improve:
Mockups above and next to results: |
|
@oliversauter what about the Hide/Undo ? is it ok? I have the UI in my todo list I will right away start working on the changes. :) |
63b2249 to
81baacc
Compare
|
@oliversauter I thinkI fixed all the major issues here, only CSS changes are to be done. Please do take a look
|




#281

Hide and Undo.
Done
Future goals:
Improve UI/UX
Refactor Code.
Add a more general Regex for google.
Apply for Bing, Duck Duck Go and more.