-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
feat: Add Creator hub link to Templates page #7721
Changes from all commits
1f083e3
dda4a56
d3d29e5
a9535ce
4a2f4f9
9c83495
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,11 @@ | |
<div :class="$style.button"> | ||
<n8n-button | ||
MiloradFilipovic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
size="large" | ||
:label="$locale.baseText('templates.newButton')" | ||
MiloradFilipovic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@click="openNewWorkflow" | ||
type="secondary" | ||
element="a" | ||
:href="creatorHubUrl" | ||
:label="$locale.baseText('templates.shareWorkflow')" | ||
target="_blank" | ||
/> | ||
</div> | ||
</div> | ||
|
@@ -90,7 +93,7 @@ import type { | |
} from '@/Interface'; | ||
import type { IDataObject } from 'n8n-workflow'; | ||
import { setPageTitle } from '@/utils'; | ||
import { VIEWS } from '@/constants'; | ||
import { CREATOR_HUB_URL, VIEWS } from '@/constants'; | ||
import { debounceHelper } from '@/mixins/debounce'; | ||
import { useSettingsStore } from '@/stores/settings.store'; | ||
import { useUsersStore } from '@/stores/users.store'; | ||
|
@@ -132,6 +135,7 @@ export default defineComponent({ | |
search: '', | ||
searchEventToTrack: null as null | ISearchEvent, | ||
errorLoadingWorkflows: false, | ||
creatorHubUrl: CREATOR_HUB_URL as string, | ||
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. Is the type cast needed? 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. Looks like it's not. Typescript was complaining it wasn't able to infer type for it but seems like it was just my editor acting weirdly |
||
}; | ||
}, | ||
computed: { | ||
|
@@ -224,10 +228,6 @@ export default defineComponent({ | |
this.searchEventToTrack = null; | ||
} | ||
}, | ||
openNewWorkflow() { | ||
this.uiStore.nodeViewInitialized = false; | ||
void this.$router.push({ name: VIEWS.NEW_WORKFLOW }); | ||
}, | ||
onSearchInput(search: string) { | ||
this.loadingWorkflows = true; | ||
this.loadingCollections = true; | ||
|
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.
I think this would be clearer if the
<a>
"button" was a separate component for couple of reasons. 1) when I use a component namedButton
I'd imagine it's a<button>
2) now we have props likehref
which doesn't make sense for a<button>
.So maybe we could have a
N8nLinkButton
or so that looks like a button, but is an<a>
element with<a>
props. These could have the same base class if DRY is a concern.E: Then again I kinda like this approach as well. But maybe in that case we could rename the
link
prop to aas
prop that isbutton
by default and can be changed toa
. And make surehref
attribute is not added unless the element is<a>
. Anyways, both are fine, you can make the call 😊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.
Yeah, DRY was my main concern here since it looks like the
Button
component still has a lot for styling in the component itself and didn't want to add more scope to this by refactoring it. So I decided to take this route (taken from other frameworks like Quasar or Element UI).Agree about the
href
validation will add that and will change thelink
prop to be string with valuesbutton
,a
but I thinkelemnent
is more clear name for it thenas