-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init home page and impelement qr gen * update types * update api and prepare ci * voting page * buffer * jwt * update vote system * update qr * update logo and main page * Add docker build --------- Co-authored-by: Nazarii Shcherbak <[email protected]>
- Loading branch information
1 parent
391ef9d
commit 4f8275f
Showing
40 changed files
with
2,066 additions
and
921 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
converge: | ||
name: Converge | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_SHA | ||
- name: Run Build | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
werf export web --tag ghcr.io/debabky/web-client:$GITHUB_SHA | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag ghcr.io/debabky/web-client && docker push ghcr.io/debabky/web-client |
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,34 @@ | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
converge: | ||
name: Converge | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_REF_NAME | ||
- name: Run Build | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
werf export web --tag ghcr.io/debabky/web-client:$GITHUB_REF_NAME | ||
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
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
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
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,8 @@ | ||
import { config } from '@/config' | ||
import { JsonApiClient } from '@distributedlab/jac' | ||
import { attachErrorHandler, attachCaseConverter } from './apiInterceptors' | ||
|
||
export const api = new JsonApiClient( | ||
{ baseUrl: config.API_URL, credentials: 'include' }, | ||
[{ error: attachErrorHandler }, { response: attachCaseConverter }], | ||
) |
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,48 @@ | ||
import { | ||
HTTP_STATUS_CODES, | ||
JsonApiResponseErrors, | ||
JsonApiRecord, | ||
} from '@distributedlab/jac' | ||
import { errors } from '@/errors' | ||
import { FetcherResponse } from '@distributedlab/fetcher' | ||
import { camelizeKeys } from 'humps' | ||
|
||
export const attachErrorHandler = async ( | ||
response: FetcherResponse<JsonApiResponseErrors>, | ||
) => { | ||
const isUnauthorized = response?.status === HTTP_STATUS_CODES.UNAUTHORIZED | ||
|
||
if (!isUnauthorized) { | ||
switch (response?.status) { | ||
case HTTP_STATUS_CODES.METHOD_NOT_ALLOWED: | ||
throw errors.MethodNotAllowed | ||
|
||
case HTTP_STATUS_CODES.BAD_REQUEST: | ||
throw errors.BadRequestError | ||
|
||
case HTTP_STATUS_CODES.CONFLICT: | ||
throw errors.ConflictError | ||
|
||
case HTTP_STATUS_CODES.UNAUTHORIZED: | ||
throw errors.UnauthorizedError | ||
|
||
case HTTP_STATUS_CODES.FORBIDDEN: | ||
throw errors.ForbiddenError | ||
|
||
case HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR: | ||
throw errors.InternalServerError | ||
|
||
default: | ||
throw errors.RuntimeError | ||
} | ||
} | ||
throw errors.TokenExpiredError | ||
} | ||
|
||
export const attachCaseConverter = ( | ||
response: FetcherResponse<JsonApiRecord>, | ||
) => { | ||
return new Promise<FetcherResponse<JsonApiRecord>>(resolve => { | ||
resolve(camelizeKeys(response) as FetcherResponse<JsonApiRecord>) | ||
}) | ||
} |
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 @@ | ||
export * from './api' |
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
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
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
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,34 @@ | ||
<template> | ||
<div class="option-item"> | ||
<p>{{ item.attributes.name }}</p> | ||
<app-button :text="$t('option-item.toggle-btn-txt')" @click="toggle" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { VoteOptions } from '@/types' | ||
import { AppButton } from '@/common' | ||
const emit = defineEmits<{ | ||
(e: 'toggle-state', id: string | number): void | ||
}>() | ||
const props = defineProps<{ | ||
item: VoteOptions | ||
}>() | ||
const toggle = () => { | ||
emit('toggle-state', props.item.id) | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.option-item { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
padding: toRem(16); | ||
border-radius: toRem(16); | ||
background: var(--background-secondary-main); | ||
} | ||
</style> |
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,80 @@ | ||
<template> | ||
<div class="vote-item"> | ||
<div v-for="field in payload" class="vote-card__payload" :key="field.lbl"> | ||
<p class="vote-item__lbl"> | ||
{{ field.lbl }} | ||
</p> | ||
<p class="vote-item__value"> | ||
{{ field.value }} | ||
</p> | ||
</div> | ||
|
||
<app-button | ||
class="vote-card__btn" | ||
:text="$t('vote-card.select-btn-txt')" | ||
@click="select" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Voting } from '@/types' | ||
import { useI18n } from 'vue-i18n' | ||
import { computed } from 'vue' | ||
import AppButton from '@/common/AppButton.vue' | ||
const emit = defineEmits<{ | ||
(e: 'select', value: Voting): void | ||
}>() | ||
const props = defineProps<{ | ||
voting: Voting | ||
}>() | ||
const { t } = useI18n() | ||
const payload = computed(() => [ | ||
{ | ||
lbl: t('vote-card.name-lbl'), | ||
value: props.voting?.name ?? '', | ||
}, | ||
{ | ||
lbl: t('vote-card.created-at-lbl'), | ||
value: props.voting?.createdAt ?? '', | ||
}, | ||
{ | ||
lbl: t('vote-card.active-until-lbl'), | ||
value: props.voting?.activeUntil ?? '', | ||
}, | ||
]) | ||
const select = () => { | ||
emit('select', props.voting) | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.vote-item { | ||
padding: toRem(16); | ||
display: grid; | ||
border-radius: toRem(16); | ||
border: solid toRem(3) var(--background-primary-dark); | ||
} | ||
.vote-card__payload { | ||
display: grid; | ||
} | ||
.vote-card__btn { | ||
margin: toRem(16) auto; | ||
width: 100%; | ||
} | ||
.vote-item__lbl { | ||
color: var(--text-primary-light); | ||
} | ||
.vote-item__value { | ||
color: var(--text-secondary-invert-dark); | ||
} | ||
</style> |
Oops, something went wrong.