-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,008 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {SET_AUTHENTICATION_STATUS} from "../constants/action-types"; | ||
|
||
const logout = (cookies, orgSlug) => { | ||
cookies.remove(`${orgSlug}_auth_token`, {path: "/"}); | ||
cookies.remove(`${orgSlug}_username`, {path: "/"}); | ||
|
||
return { | ||
type: SET_AUTHENTICATION_STATUS, | ||
payload: false, | ||
}; | ||
}; | ||
export default logout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions
89
client/components/contact-box/__snapshots__/contact.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Status /> rendering should render correctly 1`] = ` | ||
<React.Fragment> | ||
<div | ||
className="owisp-contact-container" | ||
> | ||
<div | ||
className="owisp-contact-inner" | ||
> | ||
<div | ||
className="owisp-contact-row" | ||
> | ||
<div | ||
className="owisp-contact-label" | ||
> | ||
: | ||
</div> | ||
<a | ||
className="owisp-contact-text" | ||
href="mailto:support@openwisp.co" | ||
> | ||
support@openwisp.co | ||
</a> | ||
</div> | ||
<div | ||
className="owisp-contact-row" | ||
> | ||
<div | ||
className="owisp-contact-label" | ||
> | ||
Helpdesk | ||
: | ||
</div> | ||
<a | ||
className="owisp-contact-text" | ||
href="tel:+789 948 564" | ||
> | ||
+789 948 564 | ||
</a> | ||
</div> | ||
<div | ||
className="owisp-contact-links" | ||
> | ||
<a | ||
className="owisp-contact-twitter-link owisp-contact-link" | ||
href="https://twitter.com/openwisp" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="twitter" | ||
className="owisp-contact-twitter-image owisp-contact-image" | ||
src="/assets/default/twitter.svg" | ||
/> | ||
</a> | ||
<a | ||
className="owisp-contact-facebook-link owisp-contact-link" | ||
href="https://facebook.com/openwisp" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="facebook" | ||
className="owisp-contact-facebook-image owisp-contact-image" | ||
src="/assets/default/facebook.svg" | ||
/> | ||
</a> | ||
<a | ||
className="owisp-contact-linkedIn-link owisp-contact-link" | ||
href="https://www.linkedin.com/groups/4777261" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="linkedIn" | ||
className="owisp-contact-linkedIn-image owisp-contact-image" | ||
src="/assets/default/linkedin.svg" | ||
/> | ||
</a> | ||
</div> | ||
<div | ||
className="owisp-contact-inner" | ||
/> | ||
</div> | ||
</div> | ||
</React.Fragment> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* eslint-disable camelcase */ | ||
import "./index.css"; | ||
|
||
import PropTypes from "prop-types"; | ||
import React from "react"; | ||
|
||
import getAssetPath from "../../utils/get-asset-path"; | ||
import getText from "../../utils/get-text"; | ||
|
||
export default class Contact extends React.Component { | ||
render() { | ||
const {contactPage, language, orgSlug} = this.props; | ||
const {email, helpdesk, social_links} = contactPage; | ||
return ( | ||
<React.Fragment> | ||
<div className="owisp-contact-container"> | ||
<div className="owisp-contact-inner"> | ||
<div className="owisp-contact-row"> | ||
<div className="owisp-contact-label"> | ||
{getText(email.label, language)}: | ||
</div> | ||
<a | ||
href={`mailto:${getText(email.value, language)}`} | ||
className="owisp-contact-text" | ||
> | ||
{getText(email.value, language)} | ||
</a> | ||
</div> | ||
<div className="owisp-contact-row"> | ||
<div className="owisp-contact-label"> | ||
{getText(helpdesk.label, language)}: | ||
</div> | ||
<a | ||
href={`tel:${getText(helpdesk.value, language)}`} | ||
className="owisp-contact-text" | ||
> | ||
{getText(helpdesk.value, language)} | ||
</a> | ||
</div> | ||
<div className="owisp-contact-links"> | ||
{social_links.map(link => { | ||
return ( | ||
<a | ||
href={link.url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
key={link.url} | ||
className={`owisp-contact-${getText( | ||
link.alt, | ||
language, | ||
)}-link owisp-contact-link`} | ||
> | ||
<img | ||
src={getAssetPath(orgSlug, link.icon)} | ||
alt={getText(link.alt, language)} | ||
className={`owisp-contact-${getText( | ||
link.alt, | ||
language, | ||
)}-image owisp-contact-image`} | ||
/> | ||
</a> | ||
); | ||
})} | ||
</div> | ||
<div className="owisp-contact-inner"></div> | ||
</div> | ||
</div> | ||
</React.Fragment> | ||
); | ||
} | ||
} | ||
|
||
Contact.propTypes = { | ||
language: PropTypes.string.isRequired, | ||
orgSlug: PropTypes.string.isRequired, | ||
contactPage: PropTypes.shape({ | ||
social_links: PropTypes.array, | ||
email: PropTypes.object, | ||
helpdesk: PropTypes.object, | ||
}).isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import ShallowRenderer from "react-test-renderer/shallow"; | ||
|
||
import getConfig from "../../utils/get-config"; | ||
import Contact from "./contact"; | ||
|
||
const defaultConfig = getConfig("default"); | ||
const createTestProps = props => { | ||
return { | ||
language: "en", | ||
orgSlug: "default", | ||
contactPage: defaultConfig.components.contact_page, | ||
...props, | ||
}; | ||
}; | ||
|
||
describe("<Status /> rendering", () => { | ||
let props; | ||
it("should render correctly", () => { | ||
props = createTestProps(); | ||
const renderer = new ShallowRenderer(); | ||
const component = renderer.render(<Contact {...props} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.