Skip to content

Commit

Permalink
Merge pull request #234 from facets-io/css-updates
Browse files Browse the repository at this point in the history
Css updates + fext <> api interaction
  • Loading branch information
mkotsollaris authored Feb 5, 2021
2 parents 6ea85f0 + 67357ff commit 8176d62
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: 0.4.3
release_name: 0.4.3
tag_name: 0.4.4
release_name: 0.4.4
body: |
- Documentation changes
- Improved extension interaction with the API
draft: false
prerelease: false
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ password: [email protected]
## Cookie Structure

```
FACET_EXTENSION_PREVIEW_TAB_ID: The TabID of Preview tab; updated onClick and on tab close consequently
FACET_EXTENSION_DISABLE_MO: Disables/enables the MO
FACET_EXTENSION_PREVIEW_TAB_ID: The TabID of Preview tab; updated onClick and on tab close consequently - Used by `facet-mutation-observer.js`
FACET_EXTENSION_DISABLE_MO: Disables/enables the MO in an already integrated website - Used by the API's mutation observer script.
FACET_EXTENSION_ALREADY_INTEGRATED: Domain is already integrated with facet.run
FACET_EXTENSION_INJECTING_SCRIPT_TAG: script tag that ought to be injected
```
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "react-content-script",
"version": "0.1.0",
"homepage": "https:/facets-io/facet-extension",
"private": true,
"scripts": {
Expand Down
4 changes: 0 additions & 4 deletions public/facet-mutation-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
}

const keys = {
'FACET_EXTENSION_DISABLE_MO': 'FACET_EXTENSION_DISABLE_MO',
'FACET_EXTENSION_PREVIEW_TAB_ID': 'FACET_EXTENSION_PREVIEW_TAB_ID',
'FACET_EXTENSION_ALREADY_INTEGRATED': 'FACET_EXTENSION_ALREADY_INTEGRATED',
'FACET_EXTENSION_INJECTING_SCRIPT_TAG': 'FACET_EXTENSION_INJECTING_SCRIPT_TAG',
'FACET_MAP_PREVIEW': 'FACET_MAP_PREVIEW'
}

Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Facet",
"version": "0.4.3",
"version": "0.4.4",
"description": "Facet.ninja | Deploy - Learn - Adapt",
"icons": {
"512": "facet_logo_512x512.png"
Expand Down
1 change: 1 addition & 0 deletions src/AppProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const AppProvider = ({ children }) => {
const url = `${APIUrl.apiBaseURL}/js/facetmap?id=${domainId}`;
const res = await fetch(url);
const result = await res.json();

await chrome.runtime.sendMessage({
data: ChromeRequestType.SET_COOKIE_VALUE,
config: {
Expand Down
12 changes: 5 additions & 7 deletions src/FacetToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export default function FacetToolbar() {
marginRight: '1rem'
},
grid1: {
alignSelf: 'center',
justifySelf: 'center',
marginLeft: '.5rem'
},
grid2: {
alignSelf: 'center',
Expand Down Expand Up @@ -66,14 +65,13 @@ export default function FacetToolbar() {
</div>
<div className={classes.fabGrid}>
<div className={classes.grid1}>
<a href={`${APIUrl.websiteURL}/contact/`} target="_blank">
<FacetLabel text="Contact us" />
</a>
<br />
<FacetLabel text="© Facet Ninja Technologies, 2021" />
<br />
<FacetLabel text="All rights reserved" />

<br />
<a style={{ textDecoration: 'none' }} href={`${APIUrl.websiteURL}/contact/`} target="_blank">
<FacetLabel color={color.ice} text="Contact us" />
</a>
</div>
<div className={classes.grid2}>
<Fab onClick={() => addFacet()} size='small' className={classes.fabBtn} aria-label="add">
Expand Down
15 changes: 11 additions & 4 deletions src/popup/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,25 @@ export default () => {
const [loading, setLoading] = useState(true);

const onEnablePluginCB = async (e) => {
setLoading(true);
chrome?.tabs?.query({ active: true, currentWindow: true }, (tabs) => {
chrome?.tabs?.query({ active: true, currentWindow: true }, async (tabs) => {
const urlOrigin = new URL(tabs[0].url).origin;
await chrome.cookies.set({
url: urlOrigin,
name: `FACET_EXTENSION_DISABLE_MO`,
value: Boolean(!isPluginEnabled).toString()
});
setLoading(true);

chrome.tabs.sendMessage(tabs[0].id, { [isPluginEnabledConstant]: e }, async () => {
setKeyInLocalStorage(isPluginEnabledConstant, e);
const isPluginEnabledValue = await getKeyFromLocalStorage(isPluginEnabledConstant);
setKeyInLocalStorage(isPluginEnabledConstant, isPluginEnabledValue);
setIsPluginEnabled(isPluginEnabledValue);
setLoading(false);
});
setKeyInLocalStorage(isPluginEnabledConstant, e);
setIsPluginEnabled(e);
});
setKeyInLocalStorage(isPluginEnabledConstant, e);
setIsPluginEnabled(e);
};

useEffect(() => {
Expand Down

0 comments on commit 8176d62

Please sign in to comment.