Skip to content

Commit

Permalink
better file naming in gui
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Feb 20, 2024
1 parent a41a37a commit 7939b90
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<NavBar />
<span id="jackal-logo"><img id="beacon-logo-footer" width="14" height="14" src="/public/icon.svg" />Made by Jackal Labs</span>
<span id="jackal-logo"><img id="beacon-logo-footer" width="14" height="14" src="/icon.svg" />Made by Jackal Labs</span>
<router-view />
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/utils/conversion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function sanitizeName (source: string): string {
return source.replace(/[ .+/=]/g, '_')
return source.toLowerCase().replace(/[ .+/=]/g, '_')
.replace(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\-_]/g, '')
}
6 changes: 5 additions & 1 deletion src/views/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
const test = ref('')
function requestData (owner: string, fileName: string): Promise<string> {
const url = `https://jackal.link/p/${owner}/beacon/published/${fileName}.html`
let f = fileName;
if (fileName == "introducing_beacon") {
f = "Introducing_Beacon"
}
const url = `https://jackal.link/p/${owner}/beacon/published/${f}.html`
return fetch(url)
.then(resp => resp.text())
.catch(err => {
Expand Down
15 changes: 14 additions & 1 deletion src/views/UserPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<router-link :to="`/` + address + `/` + item.name">
<div class="work-body">
<span>{{ item.date }}</span>
<h2>{{ item.name }}</h2>
<h2>{{ rename(item.name) }}</h2>
</div>
</router-link>
</li>
Expand All @@ -41,6 +41,19 @@
const address = route.params.user
function rename(val:string ) {
return toTitleCase(val.replace(new RegExp('_', 'g'), ' '))
}
function toTitleCase(str: string) {
return str.replace(
/\w\S*/g,
function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
);
}
function convertToTitleCase (str: string) {
if (!str) {
return ''
Expand Down

0 comments on commit 7939b90

Please sign in to comment.