Skip to content

Commit 3ccb1ab

Browse files
authored
Release/3.16.0 (#156)
* Feature/news (#149) * adding vuepress for blog * customising blog * reformatting blog posts. getting RSS working which will be used for modal. * got build somewhat working. now to think about how we integrate with existing app * got news working within the app. * changing blog theme version to lower version because of javascript error. Finally got iframe loading consistently. * adding in error handling * adding build script from top project level to install and compile news. Adding in some styling for news. Removing unnecessary meta data on posts. * working out behavior of news modal and close logic. Need to display news items in modal. * adding news modal - disabled. fixed issue with url not updating with iframe navigation. * simplifying get location * simplifying code * fixing bug where child gets out of sync with parent navigation. * refactor duplicated code * adding dismiss button to modal. adding links to headers of articles. * adding more style options for grid. styling up news modal. * adding new component for button icon. more styling for news modal * final styling finished for news modal. * fixing grammar mistake * fixing news tab bug * fixed sort order on feed. latest first, oldest last. got dismiss working which will take latest news item date and store in local storage. * removing date conversion as its not required. * Refactoring to help with readability of code. * lint fixes * deleting unused files. small refactor with pallette variables * fixing failing tests * 3.16.0-beta.0 * fixing bug with news navigation. lint changes * 3.16.0-beta.1 * hiding header anchor links * 3.16.0-beta.2 * changing dev deps to deps * 3.16.0-beta.3 * adding tests for getLatestNewsItems * small refactoring * adding tests for news helpers * eslint fixes * removing dummy posts * PR comments * fixing link to now navigate to news page irrelevant on the current route you are on. (#151) * Feature/auth (#152) * moving request defaults to see if it gets auth working server side. * 3.16.0-beta.4 * domain authorization (#154) * adding domain authorization feature. * 3.16.0-beta.5 * adding documentation for how to use and calling next to hook in middleware * 3.16.0-beta.6 * fix bug passing domain name to server. updated docs for overriding route. * 3.16.0-beta.7 * Simplifying code. Hiding button on unauthorized instead of disabling button. * small refactor * small refactor * removing unused code * updating tests. fixing warnings. * switching buttons in modal to use button-fill components. * fixing tests * 3.16.0-beta.8 * Feature/news release notes (#155) * splitting out news into separate posts. * creating release notes component to render github release notes. * adding fallback option if release has trouble loading. lets user visit github link instead. * updating tag for cadence-web * 3.16.0-beta.9
1 parent 6f80271 commit 3ccb1ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1047
-87
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules/
22
npm-debug.log
33
dist/
44
.vscode
5+
.DS_Store
56
.idea
67
package-lock.json
78
server/idl

client/App.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { version } from '../package.json';
33
import logo from './assets/logo.svg';
4-
import { FeatureFlag, NotificationBar } from '~components';
4+
import { FeatureFlag, NewsModal, NotificationBar } from '~components';
55
import {
66
ENVIRONMENT_LIST,
77
NOTIFICATION_TIMEOUT,
@@ -11,11 +11,13 @@ import {
1111
getEnvironment,
1212
getEnvironmentList,
1313
getEnvironmentLocation,
14+
getLatestNewsItems,
1415
} from '~helpers';
1516
1617
export default {
1718
components: {
1819
'feature-flag': FeatureFlag,
20+
'news-modal': NewsModal,
1921
'notification-bar': NotificationBar,
2022
},
2123
data() {
@@ -33,6 +35,8 @@ export default {
3335
origin,
3436
}),
3537
},
38+
newsLastUpdated: localStorage.getItem('news-last-viewed-at'),
39+
newsItems: [],
3640
logo,
3741
notification: {
3842
message: '',
@@ -45,10 +49,23 @@ export default {
4549
beforeDestroy() {
4650
clearTimeout(this.notification.timeout);
4751
},
52+
async mounted() {
53+
await this.fetchLatestNewsItems();
54+
55+
if (this.newsItems.length) {
56+
this.$modal.show('news-modal');
57+
}
58+
},
4859
methods: {
60+
async fetchLatestNewsItems() {
61+
const { newsLastUpdated } = this;
62+
const response = await this.$http('/feed.json');
63+
64+
this.newsItems = getLatestNewsItems({ newsLastUpdated, response });
65+
},
4966
globalClick(e) {
5067
// Code required for mocha tests to run correctly without infinite looping.
51-
if (e.target.tagName === 'A') {
68+
if (window.mocha !== undefined && e.target.tagName === 'A') {
5269
const href = e.target.getAttribute('href');
5370
5471
if (
@@ -76,6 +93,12 @@ export default {
7693
search,
7794
});
7895
},
96+
onNewsDismiss() {
97+
localStorage.setItem(
98+
'news-last-viewed-at',
99+
this.newsItems[0].date_modified
100+
);
101+
},
79102
onNotification({ message, type = NOTIFICATION_TYPE_SUCCESS }) {
80103
this.notification.message = message;
81104
this.notification.type = type;
@@ -151,6 +174,7 @@ export default {
151174
<router-view @onNotification="onNotification"></router-view>
152175
<modals-container />
153176
<v-dialog />
177+
<news-modal :news-items="newsItems" @before-close="onNewsDismiss" />
154178
</main>
155179
</template>
156180

client/components/button-fill.vue

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
<template>
22
<component
3+
:aria-disabled="disabled"
34
class="button-fill"
5+
:class="{
6+
disabled: disabled,
7+
[color]: color,
8+
}"
9+
:disabled="disabled"
410
:href="href"
511
:is="tag"
612
:to="to"
13+
:title="disabledLabelText"
714
@click="onClick"
815
>
916
{{ label }}
@@ -14,6 +21,16 @@
1421
export default {
1522
name: 'button-fill',
1623
props: {
24+
color: {
25+
type: String,
26+
default: 'primary',
27+
},
28+
disabled: {
29+
type: Boolean,
30+
},
31+
disabledLabel: {
32+
type: String
33+
},
1734
href: {
1835
type: String,
1936
},
@@ -28,23 +45,52 @@ export default {
2845
type: Object,
2946
},
3047
},
48+
computed: {
49+
disabledLabelText() {
50+
return this.disabled ? this.disabledLabel : '';
51+
}
52+
},
3153
methods: {
3254
onClick(...args) {
33-
this.$emit('click', ...args);
55+
if (!this.disabled) {
56+
this.$emit('click', ...args);
57+
}
3458
},
3559
},
3660
};
3761
</script>
3862

3963
<style lang="stylus">
4064
.button-fill {
65+
border: none;
4166
cursor: pointer;
4267
display: inline-block;
68+
font-size: 14px;
69+
font-weight: 600;
4370
padding: 13px 21px;
4471
transition: all 400ms ease;
45-
font-weight: 600;
4672
color: #fff !important;
47-
background-color: #11939a;
4873
white-space: nowrap;
4974
}
75+
76+
.button-fill.disabled {
77+
opacity: 0.5;
78+
cursor: not-allowed;
79+
}
80+
81+
.button-fill.primary {
82+
background-color: #11939a;
83+
84+
&:hover {
85+
background-color: #0e767b;
86+
}
87+
}
88+
89+
.button-fill.secondary {
90+
background-color: #ca3b27;
91+
92+
&:hover {
93+
background-color: #a22f1f;
94+
}
95+
}
5096
</style>

client/components/button-icon.vue

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<template>
2+
<component
3+
class="button-icon"
4+
:href="href"
5+
:is="tag"
6+
:to="to"
7+
@click="onClick"
8+
>
9+
<span class="icon" :class="icon" :style="{ 'font-size': size }" />
10+
{{ label }}
11+
</component>
12+
</template>
13+
14+
<script>
15+
export default {
16+
name: 'button-icon',
17+
props: {
18+
href: {
19+
type: String,
20+
},
21+
icon: {
22+
type: String,
23+
},
24+
label: {
25+
type: String,
26+
},
27+
size: {
28+
type: String,
29+
default: '14px',
30+
},
31+
tag: {
32+
type: String,
33+
default: 'button',
34+
},
35+
to: {
36+
type: Object,
37+
},
38+
},
39+
methods: {
40+
onClick(...args) {
41+
this.$emit('click', ...args);
42+
},
43+
},
44+
};
45+
</script>
46+
47+
<style lang="stylus">
48+
.button-icon {
49+
background-color: transparent;
50+
border: none;
51+
cursor: pointer;
52+
display: inline-block;
53+
font-weight: 600;
54+
line-height: 41px;
55+
min-width: 44px;
56+
transition: all 400ms ease;
57+
white-space: nowrap;
58+
59+
.icon {
60+
vertical-align: middle;
61+
}
62+
}
63+
</style>

client/components/feature-flag.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div class="feature-flag" v-if="isFeatureFlagEnabled">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
7+
<script>
8+
import { isFeatureFlagEnabled } from '~helpers';
9+
10+
export default {
11+
name: 'feature-flag',
12+
props: ['name'],
13+
computed: {
14+
isFeatureFlagEnabled() {
15+
const { name } = this;
16+
17+
return isFeatureFlagEnabled(name);
18+
},
19+
},
20+
};
21+
</script>

client/components/feature-flag/index.vue

Lines changed: 0 additions & 25 deletions
This file was deleted.

client/components/flex-grid.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
<template>
2-
<div class="flex-grid">
2+
<div
3+
class="flex-grid"
4+
:style="{
5+
'align-items': alignItems,
6+
'justify-content': justifyContent,
7+
}"
8+
>
39
<slot></slot>
410
</div>
511
</template>
612

13+
<script>
14+
export default {
15+
props: ['alignItems', 'justifyContent'],
16+
};
17+
</script>
18+
719
<style lang="stylus">
820
.flex-grid {
921
display: flex;

client/components/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { default as BarLoader } from './bar-loader';
22
export { default as ButtonFill } from './button-fill';
3+
export { default as ButtonIcon } from './button-icon';
34
export { default as Copy } from './copy';
45
export { default as DataViewer } from './data-viewer';
56
export { default as DetailList } from './detail-list';
@@ -13,6 +14,7 @@ export { default as LoadingMessage } from './loading-message';
1314
export { default as LoadingSpinner } from './loading-spinner';
1415
export { default as NavigationBar } from './navigation-bar';
1516
export { default as NavigationLink } from './navigation-link';
17+
export { default as NewsModal } from './news-modal';
1618
export { default as NoResults } from './no-results';
1719
export { default as NotificationBar } from './notification-bar';
1820
export { default as TextInput } from './text-input';

0 commit comments

Comments
 (0)