Skip to content

Commit

Permalink
built video results page [appends #27]
Browse files Browse the repository at this point in the history
  • Loading branch information
bignamehere committed Aug 29, 2022
1 parent e1a51c2 commit c823c6f
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 200 deletions.
15 changes: 9 additions & 6 deletions public/api/training-videos.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"relatedVideos": [
"ABCxyz1234", "XYZabc4321"
],
"searchTerms": ["prototype kit","prototype kit installation","design toolkit","installation"],
"searchTerms": ["prototype kit","prototype kit installation","design toolkit","installation","prototype"],
"desc": "This training video will show how to download, install, and setup he Prototype Kit. The Prototype Kit is an FPAC UX toolkit designed to allow for highly efficient High-fidelity HTML prototype development with the FPAC Design System.",
"transcript_url": "/training/transcripts/RGurnlgbuQ4-prototype-kit-training.pdf",
"transcript": "<h2>Prototype Kit Training</h2><br>1. Hello, my name is Casey Hill. I am a User Experience Architect for FBCSS, and today’s training will show you how to download and install the Prototype Kit version 1.<br><br>2. Before you get started, you will need to have Node version 12 or above and Node Package Manager, version 6 or above, installed on your computer.<br><br>3. Node Package Manager, also known as NPM, is used to manage the installation and build process for the Prototype Kit.<br><br>4. Feel free to hit pause on the video now, Once Node is installed on your machine, you are ready to continue.<br><br>5. The Prototype Kit is a design tool kit that can be used to quickly build high-fidelity HTML prototypes that run in your browser.<br><br>6. The Prototype Kit uses the FPAC Design System as a dependency, which will allow your prototypes to utilize the same look and feel as production ready applications.<br><br>7. Let’s get started.<br><br>8. Open a web browser and navigate to github.com/usda-fsa.<br><br>9. Within the list of repositories, click on the fsa prototype kit.<br><br>10. On the right side of the screen you will see a green dropdown button with a label that reads Clone or Download.<br><br>11. Click the button to open the dropdown panel, and either highlight or click on the Copy to Clipboard button.<br><br>12. Either within your IDE or with a Command Prompt, change directories to where you store the source files for your projects. <br><br>13. Clone the Prototype Kit repo into a new directory by typing<br><br>14. git clone Paste the URL from the clipboard and then provide a directory name for your application and hit enter.<br><br>15. The Prototype Kit project files will be downloaded to your computer<br><br>16. Back in Terminal change directories into the newly created application project directory by typing cd and the name you provided<br><br>17. Next, type npm install and hit enter.<br><br>18. It can take between 2 and 15 minutes to install all of the dependencies, so feel free to pause the video until they are completely installed.<br><br>19. A directory was added with the name of node_modules, which contains all of the required dependencies.<br><br>20. If no errors occur during this process, you are ready to build the application.<br><br>21. Type npm run build<br><br>22. This will run webpack’s build process which creates a new directory named dist.<br><br>23. Dist contains all of the files that are required to run the Prototype locally on a web server.<br><br>24. This process could take a couple minutes to complete.<br><br>25. Once built, you can type npm run start to enable and run a local web server.<br><br>26. This will automatically launch a new browser and the Sample application at localhost and running on port 8888.<br><br>27. As you can see, the application is now fully functional and you can begin building your own prototype applications."
Expand Down Expand Up @@ -47,18 +47,21 @@
},
{
"uid": "987def1234",
"title": "Color",
"category": "Visual Style",
"routePath": "/video/color",
"title": "Checkbox, Radio, & Switch",
"category": "UI Components",
"routePath": "/video/checkbox-radio-switch",
"url": "https://www.youtube.com/embed/RGurnlgbuQ4?rel=0&showinfo=0",
"videoTitleImage": "/img/video-titles/visual-style/color-title.png",
"videoTitleImage": "/img/video-titles/ui-components/checkbox-title.png",
"relatedVideos": [
"ABCxyz1234"
],
"searchTerms": ["color","colors","primary","secondary","tertiary","text color"],
"searchTerms": ["checkbox","check","checkbox group","radio","radio button","radio group","switch","toggle","toggle switch"],
"desc": "We love color, and we should make a video that talks about it.",
"transcript_url": "/training/transcripts/RGurnlgbuQ4-prototype-kit-training.pdf",
"transcript": "<h2>Color</h2><br>1. Hello, my name is Casey Hill. I am a User Experience Architect for FBCSS, and today’s training will show you how to download and install the Prototype Kit version 1.<br><br>2. Before you get started, you will need to have Node version 12 or above and Node Package Manager, version 6 or above, installed on your computer.<br><br>3. Node Package Manager, also known as NPM, is used to manage the installation and build process for the Prototype Kit.<br><br>4. Feel free to hit pause on the video now, Once Node is installed on your machine, you are ready to continue.<br><br>5. The Prototype Kit is a design tool kit that can be used to quickly build high-fidelity HTML prototypes that run in your browser.<br><br>6. The Prototype Kit uses the FPAC Design System as a dependency, which will allow your prototypes to utilize the same look and feel as production ready applications.<br><br>7. Let’s get started.<br><br>8. Open a web browser and navigate to github.com/usda-fsa.<br><br>9. Within the list of repositories, click on the fsa prototype kit.<br><br>10. On the right side of the screen you will see a green dropdown button with a label that reads Clone or Download.<br><br>11. Click the button to open the dropdown panel, and either highlight or click on the Copy to Clipboard button.<br><br>12. Either within your IDE or with a Command Prompt, change directories to where you store the source files for your projects. <br><br>13. Clone the Prototype Kit repo into a new directory by typing<br><br>14. git clone Paste the URL from the clipboard and then provide a directory name for your application and hit enter.<br><br>15. The Prototype Kit project files will be downloaded to your computer<br><br>16. Back in Terminal change directories into the newly created application project directory by typing cd and the name you provided<br><br>17. Next, type npm install and hit enter.<br><br>18. It can take between 2 and 15 minutes to install all of the dependencies, so feel free to pause the video until they are completely installed.<br><br>19. A directory was added with the name of node_modules, which contains all of the required dependencies.<br><br>20. If no errors occur during this process, you are ready to build the application.<br><br>21. Type npm run build<br><br>22. This will run webpack’s build process which creates a new directory named dist.<br><br>23. Dist contains all of the files that are required to run the Prototype locally on a web server.<br><br>24. This process could take a couple minutes to complete.<br><br>25. Once built, you can type npm run start to enable and run a local web server.<br><br>26. This will automatically launch a new browser and the Sample application at localhost and running on port 8888.<br><br>27. As you can see, the application is now fully functional and you can begin building your own prototype applications."
}
],
"excludedWords": [
"I", "a", "an", "and", "are", "as", "at", "be", "been", "but", "by", "call", "can", "come", "could", "did", "do", "each", "for", "from", "get", "go", "had", "has", "have", "he", "her", "him", "his", "how", "if", "in", "is", "it", "its", "like", "made", "make", "may", "my", "no", "now", "of", "on", "one", "or", "other", "said", "she", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "to", "two", "up", "use", "was", "water", "way", "we", "were", "what", "when", "which", "who", "will", "with", "would", "you", "your"
]
}
2 changes: 1 addition & 1 deletion src/Dashboard/_views/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<baseHeader @emitSearch="submitSearch"></baseHeader>
<baseHeader></baseHeader>

<main id="main-content" tabindex="-1">
<div class="fsa-section">
Expand Down
8 changes: 8 additions & 0 deletions src/Search/_routes/search.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

export const searchRoutes = [
{
path: '/search/:id',
component: () => import('@/Search/_views/Search.vue'),
props: true
},
]
266 changes: 266 additions & 0 deletions src/Search/_views/Search.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
<template>
<div>
<baseHeader></baseHeader>

<main id="main-content" tabindex="-1">
<div class="fsa-section">
<div class="fsa-section__bd">
<div class="fsa-m-t--l">
<div class="fsa-level@m fsa-level--justify-between">
<h1 class="fsa-m--none">Search Results</h1>
</div>
</div>
</div>
</div>

<div class="fsa-section">
<div class="fsa-section__bd">

<div class="ds-l-page">

<!-- Adjacent - START -->
<div class="ds-l-page__adjacent">

<!-- Jump Menu - START -->
<div id="jump-target">
<div class="ds-jump">
<ul class="ds-jump__list">

<li class="ds-jump__item ds-jump__item--active">
<a class="ds-jump__link" href="#main-content">Overview</a>
</li>
<li class="ds-jump__item">
<a class="ds-jump__link" href="#most-recent">Search Results</a>
</li>
<li class="ds-jump__item">
<a class="ds-jump__link" href="#popular-videos">Popular Videos</a>
</li>

</ul>
</div>
</div>
<!-- Jump Menu - END -->

</div>
<!-- Adjacent - END -->

<!-- Page Body - START -->
<div class="ds-l-page__body">
<article class="ds-article">

<div v-if="!videoResults" class="fsa-text--lead fsa-m-b--xl">
No videos were found related to <strong>'{{ searchPhrase }}'</strong>.
</div>
<div v-if="videoResults" class="fsa-text--lead fsa-m-b--xl">
Your search for <strong>'{{ searchPhrase }}'</strong> returned <strong>{{ totalResults }}</strong> videos.
</div>

<div v-if="videoResults" class="fsa-m-b--xl">
<div class="ds-subcat-list">
<ul class="ds-subcat-list__list">

<li v-for="video in videoResults" :key="video.uid" class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto( getPathFromId(video.uid) )" class="ds-subcat-list__link" :href="'/training'+ getPathFromId(video.uid)">
<span class="ds-subcat-list__text">{{ video.title }}</span>
<img :src="video.videoTitleImage" :alt="video.title" class="ds-subcat-list__img" />
</a>
</li>

</ul>
</div>
</div>



<h2 id="popular-videos" class="fsa-m-t--l">Popular Videos</h2>
<div class="ds-subcat-list">
<ul class="ds-subcat-list__list">
<li class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto('/video/buttons')" class="ds-subcat-list__link" href="/training/video/buttons">
<span class="ds-subcat-list__text">Buttons</span>

<img
class="ds-subcat-list__img"
src="/img/video-titles/ui-components/buttons-title.png"
alt
/>
</a>
</li>

<li class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto('/video/date-picker')" class="ds-subcat-list__link" href="/training/video/date-picker">
<span class="ds-subcat-list__text">Date Picker</span>

<img
class="ds-subcat-list__img"
src="/img/video-titles/ui-components/date-picker-title.png"
alt
/>
</a>
</li>

<li class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto('/video/stepped-tabs')" class="ds-subcat-list__link" href="/training/video/stepped-tabs">
<span class="ds-subcat-list__text">Stepped Tabs</span>

<img
class="ds-subcat-list__img"
src="/img/video-titles/ui-components/stepped-tabs-title.png"
alt
/>
</a>
</li>

<li class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto('/video/stepped-control')" class="ds-subcat-list__link" href="/training/video/stepped-control">
<span class="ds-subcat-list__text">Stepped Control</span>

<img
class="ds-subcat-list__img"
src="/img/video-titles/ui-components/stepped-controls-title.png"
alt
/>
</a>
</li>

<li class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto('/video/button-group')" class="ds-subcat-list__link" href="/training/video/button-group">
<span class="ds-subcat-list__text">Button Group</span>

<img
class="ds-subcat-list__img"
src="/img/video-titles/ui-components/button-group-title.png"
alt
/>
</a>
</li>

<li class="ds-subcat-list__list-item ds-subcat-list__list-item--thirds">
<a @click.prevent="goto('/video/508-accessibility')" class="ds-subcat-list__link" href="/training/video/508-accessibility">
<span class="ds-subcat-list__text">508 Accessibility</span>

<img
class="ds-subcat-list__img"
src="/img/video-titles/guides/508-title.png"
alt
/>
</a>
</li>

</ul>
</div>
</article>
</div>
<!-- Page Body - END -->
</div>

</div>
</div>
</main>

<baseFooter></baseFooter>
</div>
</template>

<script>
import { ref, onMounted, computed, watch } from "vue";
import { useStore } from "vuex";
import { useRoute } from 'vue-router';
import { useNavigation } from "@/_composables/useNavigation";
import baseHeader from "@/_partials/BaseHeader.vue";
import baseFooter from "@/_partials/BaseFooter.vue";
export default {
components: {
baseHeader,
baseFooter
},
setup(props) {
const store = useStore();
const route = useRoute();
const { goto } = useNavigation();
const videosData = computed(() => {
let data = store.getters["videos/getVideos"];
if(data) return data;
else return null;
});
const videos = ref(null);
const excludedWords = ref([]);
const videoResults = ref(null);
const searchPhrase = ref(null);
const totalResults = ref(0);
const setSearchResults = (_phrase) => {
searchPhrase.value = _phrase;
let results = videos.value.filter( (_o) => {
let isFound = false;
isFound = isFound ? true : checkSearchTeams(_phrase, _o);
isFound = isFound ? true : checkDescription(_phrase, _o);
return isFound;
});
if( results.length > 0 ){
videoResults.value = results;
totalResults.value = results.length;
} else {
videoResults.value = null;
totalResults.value = 0;
}
}
const checkSearchTeams = (_phrase, _o) => {
let ind = _o.searchTerms.findIndex( _oo => _oo.toLowerCase() == _phrase.toLowerCase() );
if( ind > -1 ) return true;
else return false;
}
const checkDescription = (_phrase, _o) => {
let desc = removeExcludedWords( _o.desc ); // strip video description of superfluous words
return desc.toLowerCase().includes( _phrase.toLowerCase() );
}
const removeExcludedWords = (_str) => {
let newStr = _str.replaceAll(',', ''); // remove commas
newStr = newStr.replaceAll('.', ''); // remove periods
newStr = newStr.replaceAll('\'', ''); // remove single quotes
newStr = newStr.replaceAll('"', ''); // remove double quotes
excludedWords.value.forEach( (_o) =>{
newStr = newStr.replaceAll(' '+_o+' ', ' ');
});
return newStr;
}
const getPathFromId = (_id) => {
let index = videos.value.findIndex( o => o.uid == _id );
let obj = videos.value[index];
return obj.routePath;
}
watch( [videosData,() => route.params.id],
([_newData, _newSearch], [_oldData, _oldSearch]) => {
videos.value = _newData.videos;
excludedWords.value = _newData.excludedWords;
if(videosData.value) setSearchResults(_newSearch);
})
onMounted(()=>{
store.dispatch("videos/setVideos");
});
return {
goto,
videoResults,
getPathFromId,
searchPhrase,
totalResults
};
}
};
</script>
25 changes: 24 additions & 1 deletion src/Shared/_views/NotFound.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
<template>
<h1>Page Not Found</h1>
<div>
<baseHeader></baseHeader>

<main id="main-content" tabindex="-1">
<div class="fsa-section">
<div class="fsa-section__bd">
<div class="fsa-m-t--l">
<div class="fsa-level@m fsa-level--justify-between">
<h1 class="fsa-m--none">Page Not Found</h1>
</div>
</div>
</div>
</div>
</main>

<baseFooter></baseFooter>
</div>
</template>

<script>
import baseHeader from "@/_partials/BaseHeader.vue";
import baseFooter from "@/_partials/BaseFooter.vue";
export default {
components: {
baseHeader,
baseFooter
},
setup(){
}
Expand Down
Loading

0 comments on commit c823c6f

Please sign in to comment.