-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger to open the support widget #1331
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
8021012
Bootstrap support widget
dallasread b1fcd20
Build and dev setup
dallasread fdecf35
Fix css variables
dallasread d89a08c
stub process.env
dallasread 1d633f9
Show a fake site on the widget dev page for context
dallasread f36c3a9
Support widget at full width
dallasread f5123a0
Show the prompt only if there are no openers
dallasread a3d1983
Open with an opener
dallasread e748150
Include the support widget in the layout
dallasread dd69d28
Move z-index
dallasread 5a751b5
Try to focus
dallasread bc29496
Add a z-index to the overlay
dallasread 4e71ce4
A little bigger size
dallasread dc575cb
Merge remote-tracking branch 'origin/main' into spike/support-widget
dallasread fd5aa7d
Setup test env
kojdm 9a374b3
Add test for main App component
kojdm a6d047e
Add tests for Article and Articles components
kojdm ced48d2
Remove unused file
dallasread c549220
Change the target of the build & build with webpack
dallasread 40e250c
Include widget in linting
dallasread 97cb37d
Linted
dallasread 009c68b
Publish to `dist`
dallasread 830bba7
Revert to `output` dir
dallasread 4e2dea7
Allow for placement from dnsimple.com
dallasread 682327f
Merge remote-tracking branch 'origin/spike/support-widget' into spike…
dallasread ce6b85c
Remove widget title
dallasread 7d595bf
Trusty size
dallasread e2a2d50
Ensure DOM is loaded before finding listener elements
dallasread dd2737b
Ensure DOM is loaded before finding listener elements (2)
dallasread 29b197a
Less jarring overlay
dallasread 06d9101
Fix focus
dallasread 8f6c52b
:robot:
dallasread a51a4f2
Only fetch the first time
dallasread beca9b2
Remove unused attr
dallasread 99d96b7
Cleanup
dallasread 6da19c6
Fix enclosing div reset
dallasread 226a96c
:robot:
dallasread dd8710d
_
dallasread 1adbdca
Remove results.js
dallasread 48b6dbe
Set an article's source to determine if it should be opened in the sa…
dallasread 906a50d
Remove unused var
dallasread 32f1efe
Lint
dallasread c5dc0cf
Set the current site url
dallasread 674fb7c
Remove the DOM content loaded func
dallasread cbc0e00
Avoid conflict
dallasread 6ebfc29
Add a slight shadow
dallasread 1be3ab6
Show on mobile
dallasread eeccbfb
Merge remote-tracking branch 'origin/main' into spike/support-widget-…
dallasread 7eaaf56
Style the top input like the existing site
dallasread 05d85fd
Search icon color
dallasread 5930f14
Header color
dallasread File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<template> | ||
<div id="dnsimple-support"> | ||
<div v-if="isOpen" class="relative animated fadeInUp faster"> | ||
<Header :app="app" ref="header"/> | ||
<Component :is="currentRoute[0]" :app="app" :article="currentRoute[1]"></Component> | ||
<div v-if="isOpen"> | ||
<div class="overlay" @click="close"></div> | ||
<div class="dnsimple-modal animated fadeInUp faster"> | ||
<Header :app="app" ref="header"/> | ||
<Component :is="currentRoute[0]" :app="app" :article="currentRoute[1]"></Component> | ||
</div> | ||
</div> | ||
<Prompt v-else :app="app"/> | ||
<Prompt v-else-if="showPrompt" :app="app"/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { nextTick } from 'vue'; | ||
import { urlMatchingDictionary } from './url-dictionary.js'; | ||
|
||
import Footer from '../footer/component.vue'; | ||
|
@@ -38,6 +42,13 @@ export default { | |
props: { | ||
query: { | ||
default: '' | ||
}, | ||
showPrompt: { | ||
default: true | ||
}, | ||
currentSiteUrl: { | ||
type: String, | ||
default: '' | ||
} | ||
}, | ||
data () { | ||
|
@@ -51,7 +62,7 @@ export default { | |
q: query, | ||
isOpen: false, | ||
isLoading: true, | ||
rootURL: 'https://support.dnsimple.com', | ||
isFetched: false, | ||
history: [] | ||
}; | ||
}, | ||
|
@@ -68,7 +79,9 @@ export default { | |
|
||
computed: { | ||
filteredArticles () { | ||
return window.DNSimpleSupport.search(this.q); | ||
const articles = window.DNSimpleSupport.search(this.q); | ||
articles.forEach((a) => { a.source = 'https://support.dnsimple.com'; }); | ||
return articles; | ||
}, | ||
|
||
noResults () { | ||
|
@@ -101,27 +114,33 @@ export default { | |
}, | ||
|
||
focus () { | ||
const $header = this.$refs.header; | ||
nextTick(() => { | ||
const $header = this.$refs.header; | ||
|
||
if ($header !== null && $header !== undefined) | ||
$header.$refs.input.focus(); | ||
if ($header !== null && $header !== undefined) | ||
$header.$refs.input.focus(); | ||
}); | ||
}, | ||
|
||
close () { | ||
this.isOpen = false; | ||
}, | ||
|
||
fetchArticles (done) { | ||
if (this.isFetched) return done(); | ||
|
||
const script = document.createElement('script'); | ||
|
||
this.isLoading = true; | ||
|
||
script.type = 'text/javascript'; | ||
script.src = `${this.rootURL}/search.js`; | ||
script.src = `https://support.dnsimple.com/search.js`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This'll be cleaned up when we add multiple sources (eg. dev site articles). |
||
|
||
script.onload = () => { | ||
setTimeout(() => { | ||
this.isFetched = true; | ||
this.isLoading = false; | ||
done(); | ||
}, 500); | ||
}; | ||
|
||
|
@@ -130,6 +149,10 @@ export default { | |
|
||
setQ (q) { | ||
this.q = q; | ||
}, | ||
|
||
getCurrentSiteUrl() { | ||
return this.currentSiteUrl; | ||
} | ||
} | ||
}; | ||
|
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 |
---|---|---|
@@ -1,31 +1,54 @@ | ||
#dnsimple-support-widget { | ||
position: fixed; | ||
z-index: 999; | ||
bottom: 0; | ||
right: 0; | ||
width: 480px; | ||
font-size: var(--dnsimple-support-widget-rem); | ||
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | ||
line-height: 1.6; | ||
color: #222; | ||
z-index: 999; | ||
|
||
@media (var(--dnsimple-support-widget-desktop-only)) { | ||
display: none; | ||
} | ||
} | ||
|
||
#dnsimple-support { | ||
z-index: 999; | ||
|
||
.dnsimple-modal { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
left: 0; | ||
margin-top: 5vh; | ||
z-index: 999; | ||
max-width: 45rem; | ||
margin-left: auto; | ||
margin-right: auto; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.25); | ||
} | ||
|
||
.overlay { | ||
position: fixed; | ||
z-index: 998; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
background: rgba(0, 0, 0, 0.5); | ||
} | ||
|
||
.relative { | ||
position: relative; | ||
box-shadow: var(--dnsimple-support-widget-box-shadow); | ||
} | ||
|
||
.route { | ||
height: 475px; | ||
border-left: 1px solid var(--dnsimple-support-widget-line-color); | ||
border: 1px solid var(--dnsimple-support-widget-line-color); | ||
overflow-y: auto; | ||
-webkit-overflow-scrolling: touch; | ||
padding: var(--dnsimple-support-widget-padding); | ||
background: var(--dnsimple-support-widget-white); | ||
border-bottom-left-radius: 4px; | ||
border-bottom-right-radius: 4px; | ||
height: 75vh; | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to wait a tick before the input is rendered.