-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
itupix
committed
Jan 4, 2021
1 parent
7a4bfe7
commit 035a0cd
Showing
25 changed files
with
459 additions
and
86 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,68 @@ | ||
<script lang="ts"> | ||
import type { PullRequestType } from 'models/skizzle/PullRequestType'; | ||
import Icons from 'components/icons'; | ||
import { ProviderEnum } from '../../models/skizzle/ProviderEnum'; | ||
import { Service } from 'services/Service'; | ||
export let pullRequest: PullRequestType; | ||
export let className: string; | ||
const images = { | ||
[ProviderEnum.Github]: Icons.Github, | ||
[ProviderEnum.AzureDevOps]: Icons.AzureDevOps, | ||
}; | ||
</script> | ||
|
||
<style> | ||
.container { | ||
position: relative; | ||
width: 4rem; | ||
height: 4rem; | ||
} | ||
.avatar { | ||
overflow: hidden; | ||
border-radius: 50%; | ||
border: 2px solid #fff; | ||
} | ||
img { | ||
display: block; | ||
width: 100%; | ||
height: auto; | ||
} | ||
.badge { | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
border-radius: 50%; | ||
border: 2px solid #fff; | ||
background-color: #333; | ||
} | ||
.badge :global(svg) { | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
width: 60%; | ||
height: auto; | ||
transform: translateY(-50%) translateX(-50%); | ||
} | ||
</style> | ||
|
||
<div class={`container ${className || ''}`}> | ||
{#await Service.getAvatar(pullRequest.provider, pullRequest.user.avatar, pullRequest.organizationName)} | ||
<p>Chargement...</p> | ||
{:then avatar} | ||
<div class="avatar"><img src={avatar} alt={pullRequest.user.name} /></div> | ||
{#if pullRequest.provider} | ||
<div class="badge"> | ||
<svelte:component this={Icons[pullRequest.provider]} /> | ||
</div> | ||
{/if} | ||
{:catch} | ||
<p>Erreur</p> | ||
{/await} | ||
</div> |
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 { default } from './Avatar.svelte'; |
71 changes: 71 additions & 0 deletions
71
src/components/CustomListSettings/CustomListSettings.svelte
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,71 @@ | ||
<script lang="ts"> | ||
import type { CustomListType } from 'models/skizzle/CustomListType'; | ||
import AccountTitle from 'components/AccountTitle'; | ||
import { projects, repositories } from 'shared/stores/default.store'; | ||
let numberOfProjectsFields: number = 1; | ||
let numberOfRepositoriesFields: number = 1; | ||
let listName: string; | ||
let projectsIds: string[] = []; | ||
let repositoriesIds: string[] = []; | ||
const onSubmit = event => { | ||
event.preventDefault(); | ||
console.log({ listName, repositoriesIds }); | ||
}; | ||
console.log({ $repositories }); | ||
</script> | ||
|
||
<style> | ||
fieldset:not(:last-child) { | ||
margin-bottom: 2rem; | ||
} | ||
label { | ||
display: block; | ||
} | ||
</style> | ||
|
||
<form on:submit={onSubmit}> | ||
<AccountTitle>Nouvelle liste</AccountTitle> | ||
<fieldset> | ||
<div class="field"> | ||
<label for="list-name">Nom de la liste</label> | ||
<input bind:value={listName} id="list-name" type="text" /> | ||
</div> | ||
</fieldset> | ||
|
||
{#if $projects.length} | ||
<fieldset> | ||
<div> | ||
<label for="project">Afficher uniquement les pull requests de ces projets</label> | ||
<select id="project"> | ||
{#each $projects as project} | ||
<option value={project.projectId}>{project.name}</option> | ||
{/each} | ||
</select> | ||
</div> | ||
</fieldset> | ||
{/if} | ||
|
||
{#if $repositories.length} | ||
<fieldset> | ||
<div> | ||
<label for="repos">Afficher uniquement les pull requests de ces repositories</label> | ||
<select | ||
value={repositoriesIds[0]} | ||
id="repos" | ||
on:blur={e => { | ||
repositoriesIds.push(e.target.value); | ||
}}> | ||
{#each $repositories.filter(({ checked }) => checked) as repository} | ||
<option value={repository.repositoryId}>{repository.name}</option> | ||
{/each} | ||
</select> | ||
</div> | ||
</fieldset> | ||
{/if} | ||
|
||
<input disabled={!listName} type="submit" value="Créer la liste" /> | ||
</form> |
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 { default } from './CustomListSettings.svelte'; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,19 +1,99 @@ | ||
<script> | ||
import Navigation from '../Navigation'; | ||
import Accounts from '../Accounts'; | ||
<script lang="ts"> | ||
import type { CommentType } from 'models/skizzle/CommentType'; | ||
import type { CustomListType } from 'models/skizzle/CustomListType'; | ||
import { pullRequests } from 'shared/stores/default.store'; | ||
import PullRequest from 'components/PullRequest'; | ||
import Tabs from 'components/Tabs'; | ||
import Modale from 'components/Modale'; | ||
import CustomListSettings from 'components/CustomListSettings'; | ||
// let creatingList: boolean = false; | ||
let creatingList: boolean = true; | ||
const customLists: CustomListType[] = [ | ||
{ | ||
name: 'Agenda partagé', | ||
projectsIds: ['51f756a1-4881-4ff4-ad15-91f43256bb86'], | ||
withoutOwnedByUserPR: true, | ||
}, | ||
{ | ||
name: 'Skizzle', | ||
repositoriesIds: [218745280], | ||
}, | ||
]; | ||
$: fetchedComments = Promise.resolve<CommentType[]>([]); | ||
const tabs = { | ||
all: 'Toutes', | ||
}; | ||
customLists.forEach(({ name }, index) => { | ||
tabs[index] = name; | ||
}); | ||
let currentTab: string = 'all'; | ||
</script> | ||
|
||
<style> | ||
main { | ||
display: flex; | ||
.content { | ||
height: calc(100vh - 6rem); | ||
flex: 1 0 auto; | ||
padding: 1rem; | ||
overflow: auto; | ||
background-color: #4e4e4e; | ||
} | ||
main :global(.view) { | ||
flex: 1 0 auto; | ||
.list { | ||
list-style: none; | ||
} | ||
.list li:not(:last-child) { | ||
margin-bottom: 1rem; | ||
} | ||
</style> | ||
|
||
<main> | ||
<Navigation /> | ||
<Accounts /> | ||
</main> | ||
<Tabs | ||
current={currentTab} | ||
onChange={tab => (currentTab = tab)} | ||
data={tabs} | ||
onCreation={() => { | ||
creatingList = true; | ||
}} /> | ||
|
||
<div class="content"> | ||
{#if currentTab === 'all'} | ||
<ul class="list"> | ||
{#each $pullRequests.sort((a, b) => Date.parse(b.date) - Date.parse(a.date)) as pullRequest} | ||
<li> | ||
<PullRequest | ||
{pullRequest} | ||
on:comments={event => (fetchedComments = event.detail.fetchedComment)} /> | ||
</li> | ||
{/each} | ||
</ul> | ||
{:else} | ||
<ul class="list"> | ||
{#each $pullRequests | ||
.filter(pullRequest => { | ||
return customLists[currentTab].projectsIds ? customLists[currentTab].projectsIds.includes(pullRequest.projectId) : true; | ||
}) | ||
.filter(pullRequest => { | ||
return customLists[currentTab].repositoriesIds ? customLists[currentTab].repositoriesIds.includes(pullRequest.repositoryId) : true; | ||
}) | ||
.sort((a, b) => Date.parse(b.date) - Date.parse(a.date)) as pullRequest} | ||
<li> | ||
<PullRequest | ||
{pullRequest} | ||
on:comments={event => (fetchedComments = event.detail.fetchedComment)} /> | ||
</li> | ||
{/each} | ||
</ul> | ||
{/if} | ||
</div> | ||
{#if creatingList} | ||
<Modale | ||
onClose={() => { | ||
creatingList = false; | ||
}}> | ||
<CustomListSettings /> | ||
</Modale> | ||
{/if} |
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
Oops, something went wrong.