Skip to content

Commit

Permalink
Rename smart to quick connect
Browse files Browse the repository at this point in the history
  • Loading branch information
tadaskay committed Sep 9, 2021
1 parent aa7f245 commit 7fb820e
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/app/config/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface DesktopConfig {
onboarded?: boolean
dns?: DNSOption
"nat-compatibility"?: "auto" | "off"
"smart-connect"?: boolean
"quick-connect"?: boolean
filters?: ProposalFilters
}

Expand Down Expand Up @@ -77,8 +77,8 @@ export class ConfigStore {
setAutoNATCompatibility: action,
onboarded: computed,
setOnboarded: action,
smartConnect: computed,
setSmartConnect: action,
quickConnect: computed,
setQuickConnect: action,
})
}

Expand Down Expand Up @@ -155,11 +155,11 @@ export class ConfigStore {
return this.updateConfigPartial({ "nat-compatibility": enabled ? "auto" : "off" })
}

get smartConnect(): boolean {
return this.config.desktop?.["smart-connect"] !== false
get quickConnect(): boolean {
return this.config.desktop?.["quick-connect"] !== false
}

setSmartConnect = async (enabled: boolean): Promise<void> => {
return this.updateConfigPartial({ "smart-connect": enabled })
setQuickConnect = async (enabled: boolean): Promise<void> => {
return this.updateConfigPartial({ "quick-connect": enabled })
}
}
5 changes: 2 additions & 3 deletions src/app/connection/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,17 @@ export class ConnectionStore {
}
}

async smartConnect(): Promise<void> {
async quickConnect(): Promise<void> {
if (!this.root.identity.identity) {
return
}
log.info("Smart connect preset:", this.root.filters.presetID, "country:", this.root.filters.country)
this.setConnectInProgress(true)
this.setGracePeriod()
this.root.proposals.setActiveProposal(_.sample(this.root.proposals.filteredProposals))
if (!this.root.proposals.active) {
return
}
userEvent(ConnectionAction.SmartConnect, this.root.proposals.active.country)
userEvent(ConnectionAction.QuickConnect, this.root.proposals.active.country)
try {
await tequilapi.connectionCreate(
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/navigation/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const locations = {
consumer: "/consumer",
proposals: "/consumer/proposals",
proposalsManualConnect: "/consumer/proposals/manual-connect",
proposalsSmartConnect: "/consumer/proposals/smart-connect",
proposalsQuickConnect: "/consumer/proposals/quick-connect",
connection: "/consumer/connection",
referrals: "/referrals",
help: "/help",
Expand Down
8 changes: 4 additions & 4 deletions src/app/views/consumer/Proposals/ProposalsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ import { locations } from "../../../navigation/locations"
import { useStores } from "../../../store"

import { ManualConnectView } from "./ManualConnectView"
import { SmartConnectView } from "./SmartConnectView"
import { QuickConnectView } from "./QuickConnectView"

export const ProposalsView: React.FC = observer(() => {
const { config } = useStores()
return (
<>
<Switch>
<Route path={locations.proposalsSmartConnect}>
<SmartConnectView />
<Route path={locations.proposalsQuickConnect}>
<QuickConnectView />
</Route>
<Route path={locations.proposalsManualConnect}>
<ManualConnectView />
</Route>
<Redirect
to={config.smartConnect ? locations.proposalsSmartConnect : locations.proposalsManualConnect}
to={config.quickConnect ? locations.proposalsQuickConnect : locations.proposalsManualConnect}
/>
</Switch>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { brand } from "../../../ui-kit/colors"
import { Preset } from "../../../proposals/components/Preset/Preset"
import { RippleButton } from "../../../ui-kit/components/Button/RippleButton"

import animationSmartConnect from "./animation_smart_connect.json"
import animationQuickConnect from "./animation_quick_connect.json"
import { SwitchConnectView } from "./SwitchConnectView"

const Sidebar = styled(ViewSidebar)`
Expand Down Expand Up @@ -66,7 +66,7 @@ const SideBot = styled.div`
}
`

const SmartConnectButtonContainer = styled.div`
const QuickConnectButtonContainer = styled.div`
position: absolute;
bottom: 0;
box-sizing: border-box;
Expand All @@ -76,20 +76,20 @@ const SmartConnectButtonContainer = styled.div`
background: ${brand};
`

const SmartConnectButton = styled(RippleButton)`
const QuickConnectButton = styled(RippleButton)`
width: 222px;
height: 73px;
padding-top: 10px;
line-height: 63px;
font-size: 18px;
`

export const SmartConnectView: React.FC = observer(() => {
export const QuickConnectView: React.FC = observer(() => {
const { proposals, connection } = useStores()
const handleConnectClick = async (): Promise<void> => {
if (connection.status === ConnectionStatus.NOT_CONNECTED) {
try {
return await connection.smartConnect()
return await connection.quickConnect()
} catch (reason) {
toast.error(function errorToast() {
return (
Expand Down Expand Up @@ -118,16 +118,16 @@ export const SmartConnectView: React.FC = observer(() => {
<SideBot>
<CountryFilter />
</SideBot>
<SmartConnectButtonContainer>
<SmartConnectButton onClick={handleConnectClick}>Connect</SmartConnectButton>
</SmartConnectButtonContainer>
<QuickConnectButtonContainer>
<QuickConnectButton onClick={handleConnectClick}>Quick Connect</QuickConnectButton>
</QuickConnectButtonContainer>
</Sidebar>
<ViewContent>
<div>
<Lottie
play
loop={true}
animationData={animationSmartConnect}
animationData={animationQuickConnect}
style={{ width: 378, height: 486 }}
renderer="svg"
/>
Expand Down
14 changes: 7 additions & 7 deletions src/app/views/consumer/Proposals/SwitchConnectView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ const SwitchLink = styled.div<{ active: boolean }>`
export const SwitchConnectView: React.FC = observer(() => {
const { router, config } = useStores()
const manual = router.location.pathname == locations.proposalsManualConnect
const smart = router.location.pathname == locations.proposalsSmartConnect
const quick = router.location.pathname == locations.proposalsQuickConnect
return (
<Container>
<SwitchGroup>
<SwitchLink active={smart}>
{!smart ? (
<Link to={locations.proposalsSmartConnect} onClick={() => config.setSmartConnect(true)}>
Smart Connect
<SwitchLink active={quick}>
{!quick ? (
<Link to={locations.proposalsQuickConnect} onClick={() => config.setQuickConnect(true)}>
Quick Connect
</Link>
) : (
<a>Smart Connect</a>
<a>Quick Connect</a>
)}
</SwitchLink>
<SwitchLink active={manual}>
{!manual ? (
<Link to={locations.proposalsManualConnect} onClick={() => config.setSmartConnect(false)}>
<Link to={locations.proposalsManualConnect} onClick={() => config.setQuickConnect(false)}>
Manual Connect
</Link>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/shared/analytics/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export enum ProposalViewAction {

export enum ConnectionAction {
Connect = "Connect",
SmartConnect = "Smart Connect",
QuickConnect = "Quick Connect",
Disconnect = "Disconnect",
}

Expand Down

0 comments on commit 7fb820e

Please sign in to comment.