-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 💄 Init Gutenberg page UI * 💄 Add book list csv * 💄 Update page UI based on new design * 📲 Adjust RWD * 💄 Update button style * 💄 Update dialog to display book list * 🎨 Improve style format * 🎨 Add api to fetch csv * ➕ Add plyr to display video * 💄 Add substack embed * 📲 Adjust phone version margin * 🚸 Add anchor * 🎨 Open all redirects in a new page * 💬 Add line break for zh title * 💩 Add entrance for gutenberg page * 🍱 Update list csv * 🐛 Update fetchGutenbergCsv endpoint * 💄 Add free download book list & modify UI * 🐛 Fix swiper breakpoint * 🐛 Fix plyr not found * 💄 Adjust blende section UI * 🐛 Fix swiper broken on phone version * 🚧 Temporarily hide the download section on mobile * 💄 Add pointer for table list
- Loading branch information
1 parent
3c91be5
commit eb8247e
Showing
29 changed files
with
3,810 additions
and
4 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<template> | ||
<div | ||
:class="[ | ||
'flex', | ||
'relative', | ||
'border-[1px]', | ||
'border-like-green', | ||
'border-opacity-75', | ||
'rounded-[48px]', | ||
'py-[8px]', | ||
'px-[24px]', | ||
'group', | ||
'cursor-pointer', | ||
hoverBorderClasses, | ||
]" | ||
v-on="$listeners" | ||
> | ||
{{ text }} | ||
<div | ||
:class="[ | ||
'absolute', | ||
'bg-shade-gray', | ||
'text-shade-gray', | ||
{ '!bg-like-cyan-light !text-like-cyan-light': preset === 'primary' }, | ||
'whitespace-nowrap', | ||
'top-[6px]', | ||
'left-[6px]', | ||
'rounded-[48px]', | ||
'py-[8px]', | ||
'px-[24px]', | ||
'-z-1', | ||
hoverClasses, | ||
'transition', | ||
'duration-200', | ||
]" | ||
> | ||
{{ text }} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'GutenbergButton', | ||
props: { | ||
text: { | ||
type: String, | ||
default: '', | ||
}, | ||
preset: { | ||
type: String, | ||
default: 'secondary', | ||
}, | ||
}, | ||
computed: { | ||
hoverBorderClasses() { | ||
return this.preset === 'primary' | ||
? 'group-hover:border-opacity-50 active:border-opacity-70' | ||
: 'group-hover:border-opacity-50 active:border-opacity-70'; | ||
}, | ||
hoverClasses() { | ||
return this.preset === 'primary' | ||
? 'group-hover:!bg-like-cyan group-hover:!text-like-cyan' | ||
: 'group-hover:!bg-medium-gray group-hover:!text-medium-gray '; | ||
}, | ||
}, | ||
}; | ||
</script> |
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 |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<template> | ||
<Dialog | ||
:open="isOpenDialog" | ||
class="w-full max-w-[900px]" | ||
:header-text="$t('gutenberg_dialog_title')" | ||
panel-component="CardV2" | ||
panel-container-class="!max-w-[920px]" | ||
panel-class="overflow-y-scroll shadow-lg" | ||
@close="$emit('close')" | ||
> | ||
<div class="flex w-full"> | ||
<table class="w-full text-[14px]"> | ||
<thead class="border-b-shade-gray border-b-[2px]"> | ||
<tr class="text-medium-gray"> | ||
<th class="py-[12px] text-[14px] text-left"> | ||
{{ $t('gutenberg_dialog_title_classTitle') }} | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="(row, rowIndex) in csvData" | ||
:key="rowIndex" | ||
:class="[ | ||
'py-[12px] cursor-pointer border-b-shade-gray border-b-[1px] text-dark-gray hover:bg-light-gray transition-colors', | ||
{ | ||
'cursor-not-allowed': | ||
!csvData[rowIndex].classId || | ||
csvData[rowIndex].classId === 'failed', | ||
}, | ||
]" | ||
@click=" | ||
() => { | ||
handleClickRow(csvData[rowIndex].classId); | ||
} | ||
" | ||
> | ||
<td | ||
:class="{ | ||
'!text-shade-gray': | ||
!csvData[rowIndex].classId || | ||
csvData[rowIndex].classId === 'failed', | ||
}" | ||
> | ||
{{ row.classTitle }} | ||
</td> | ||
<td> | ||
{{ row.editionTitleEn }} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</Dialog> | ||
</template> | ||
|
||
<script> | ||
import { ellipsis } from '~/util/ui'; | ||
import { fetchGutenbergCsv } from '~/util/api'; | ||
import csvParser from 'csv-parser'; | ||
const DISPLAY_COLUMN = ['classTitle', 'classId']; | ||
export default { | ||
filters: { | ||
ellipsis, | ||
}, | ||
props: { | ||
isOpenDialog: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
csvData: [], | ||
csvHeader: [], | ||
}; | ||
}, | ||
async mounted() { | ||
await this.loadCSVFile(DISPLAY_COLUMN); | ||
}, | ||
methods: { | ||
async loadCSVFile(displayColumn) { | ||
this.csvHeader = displayColumn; | ||
try { | ||
const response = await this.$api.$get(fetchGutenbergCsv()); | ||
const parsedData = []; | ||
const csvStream = csvParser({ headers: false }); | ||
csvStream.write(response); | ||
csvStream.end(); | ||
csvStream.on('data', record => { | ||
parsedData.push(record); | ||
}); | ||
csvStream.on('end', () => { | ||
const headerValues = Object.values(parsedData[0]); | ||
const headerMap = []; | ||
displayColumn.forEach(name => { | ||
const num = headerValues.indexOf(name); | ||
if (num !== -1) { | ||
headerMap.push(num); | ||
} | ||
}); | ||
const selectedData = parsedData.map(row => { | ||
const selectedRow = {}; | ||
headerMap.forEach(index => { | ||
const columnName = headerValues[index]; | ||
selectedRow[columnName] = row[index]; | ||
}); | ||
return selectedRow; | ||
}); | ||
if (selectedData && selectedData.length) { | ||
this.csvData = selectedData.splice(1); | ||
} else { | ||
this.csvData = []; | ||
} | ||
}); | ||
} catch (error) { | ||
// eslint-disable-next-line no-console | ||
console.error('Error loading CSV file:', error); | ||
} | ||
}, | ||
handleClickRow(classId) { | ||
if (!classId || classId === 'failed') { | ||
return; | ||
} | ||
const url = this.$router.resolve( | ||
this.localeLocation({ | ||
name: 'nft-class-classId', | ||
params: { | ||
classId, | ||
}, | ||
}) | ||
).href; | ||
window.open(url, '_blank'); | ||
}, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.