feat: gh repo tweaks
This commit is contained in:
parent
29242aa45d
commit
56402d789c
|
@ -91,16 +91,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||||
final repo = data.item1!;
|
final repo = data.item1!;
|
||||||
return ActionButton(
|
return ActionButton(
|
||||||
title: AppLocalizations.of(context)!.repositoryActions,
|
title: AppLocalizations.of(context)!.repositoryActions,
|
||||||
items: [
|
items: ActionItem.getUrlActions(repo.url),
|
||||||
ActionItem(
|
|
||||||
text:
|
|
||||||
'${AppLocalizations.of(context)!.projects}(${repo.projects.totalCount})',
|
|
||||||
onTap: (_) {
|
|
||||||
launchStringUrl(repo.projectsUrl);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
...ActionItem.getUrlActions(repo.url),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
bodyBuilder: (data, setData) {
|
bodyBuilder: (data, setData) {
|
||||||
|
@ -260,7 +251,8 @@ class GhRepoScreen extends StatelessWidget {
|
||||||
if (repo.hasIssuesEnabled)
|
if (repo.hasIssuesEnabled)
|
||||||
AntListItem(
|
AntListItem(
|
||||||
prefix: const Icon(Octicons.issue_opened),
|
prefix: const Icon(Octicons.issue_opened),
|
||||||
extra: Text(numberFormat.format(repo.issues.totalCount)),
|
extra: Text(
|
||||||
|
'${numberFormat.format(repo.issuesOpen.totalCount)} / ${numberFormat.format(repo.issues.totalCount)}'),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
context.push('/github/$owner/$name/issues');
|
context.push('/github/$owner/$name/issues');
|
||||||
},
|
},
|
||||||
|
@ -268,18 +260,44 @@ class GhRepoScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
AntListItem(
|
AntListItem(
|
||||||
prefix: const Icon(Octicons.git_pull_request),
|
prefix: const Icon(Octicons.git_pull_request),
|
||||||
extra:
|
extra: Text(
|
||||||
Text(numberFormat.format(repo.pullRequests.totalCount)),
|
'${numberFormat.format(repo.pullRequestsOpen.totalCount)} / ${numberFormat.format(repo.pullRequests.totalCount)}'),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
context.push('/github/$owner/$name/pulls');
|
context.push('/github/$owner/$name/pulls');
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.pullRequests),
|
child: Text(AppLocalizations.of(context)!.pullRequests),
|
||||||
),
|
),
|
||||||
|
if (repo.discussions.totalCount > 0)
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.comment_discussion),
|
||||||
|
extra:
|
||||||
|
Text(numberFormat.format(repo.discussions.totalCount)),
|
||||||
|
onClick: () {
|
||||||
|
context.pushUrl(
|
||||||
|
'https://github.com/$owner/$name/discussions'); // TODO: discussions screen
|
||||||
|
},
|
||||||
|
child: const Text('Discussions'),
|
||||||
|
),
|
||||||
|
if (repo.hasProjectsEnabled && repo.projects.totalCount > 0)
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.project),
|
||||||
|
extra: Text(numberFormat.format(repo.projects.totalCount)),
|
||||||
|
onClick: () {
|
||||||
|
context.pushUrl(repo.projectsUrl);
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.projects),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
CommonStyle.verticalGap,
|
||||||
|
AntList(
|
||||||
|
children: [
|
||||||
if (ref != null) ...[
|
if (ref != null) ...[
|
||||||
AntListItem(
|
AntListItem(
|
||||||
prefix: const Icon(Octicons.history),
|
prefix: const Icon(Octicons.history),
|
||||||
extra: Text(((ref.target as GRepoCommit).history.totalCount)
|
extra: Text(
|
||||||
.toString()),
|
((ref.target as GCommitParts).history.totalCount)
|
||||||
|
.toString()),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
context.push('/github/$owner/$name/commits/${ref.name}');
|
context.push('/github/$owner/$name/commits/${ref.name}');
|
||||||
},
|
},
|
||||||
|
@ -312,19 +330,21 @@ class GhRepoScreen extends StatelessWidget {
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.branches),
|
child: Text(AppLocalizations.of(context)!.branches),
|
||||||
),
|
),
|
||||||
AntListItem(
|
],
|
||||||
prefix: const Icon(Octicons.organization),
|
AntListItem(
|
||||||
extra: FutureBuilder<int>(
|
prefix: const Icon(Octicons.people),
|
||||||
future: contributionFuture,
|
extra: FutureBuilder<int>(
|
||||||
builder: (context, snapshot) {
|
future: contributionFuture,
|
||||||
return Text(snapshot.data?.toString() ?? '');
|
builder: (context, snapshot) {
|
||||||
},
|
return Text(snapshot.data?.toString() ?? '');
|
||||||
),
|
|
||||||
onClick: () {
|
|
||||||
context.push('/github/$owner/$name/contributors');
|
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.contributors),
|
|
||||||
),
|
),
|
||||||
|
onClick: () {
|
||||||
|
context.push('/github/$owner/$name/contributors');
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.contributors),
|
||||||
|
),
|
||||||
|
if (repo.releases.totalCount > 0)
|
||||||
AntListItem(
|
AntListItem(
|
||||||
prefix: const Icon(Octicons.book),
|
prefix: const Icon(Octicons.book),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
|
@ -333,7 +353,6 @@ class GhRepoScreen extends StatelessWidget {
|
||||||
extra: Text(repo.releases.totalCount.toString()),
|
extra: Text(repo.releases.totalCount.toString()),
|
||||||
child: Text(AppLocalizations.of(context)!.releases),
|
child: Text(AppLocalizations.of(context)!.releases),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
MarkdownView(readmeData),
|
MarkdownView(readmeData),
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
fragment RepoCommit on Commit {
|
fragment CommitParts on Commit {
|
||||||
history {
|
history {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment RepoRef on Ref {
|
fragment RefParts on Ref {
|
||||||
name
|
name
|
||||||
target {
|
target {
|
||||||
... on Commit {
|
... on Commit {
|
||||||
...RepoCommit
|
...CommitParts # extracted to fragment for type cast
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,21 @@ query Repo(
|
||||||
homepageUrl
|
homepageUrl
|
||||||
isPrivate
|
isPrivate
|
||||||
isFork
|
isFork
|
||||||
diskUsage
|
|
||||||
hasIssuesEnabled
|
|
||||||
url
|
url
|
||||||
viewerHasStarred
|
viewerHasStarred
|
||||||
viewerSubscription
|
viewerSubscription
|
||||||
projectsUrl
|
|
||||||
primaryLanguage {
|
repositoryTopics(first: 10) {
|
||||||
color
|
nodes {
|
||||||
name
|
url
|
||||||
|
topic {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watchers {
|
||||||
|
totalCount
|
||||||
}
|
}
|
||||||
stargazers {
|
stargazers {
|
||||||
totalCount
|
totalCount
|
||||||
|
@ -45,21 +51,7 @@ query Repo(
|
||||||
forks {
|
forks {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
watchers {
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
issues(states: OPEN) {
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
pullRequests(states: OPEN) {
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
projects {
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
releases {
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
|
languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
|
||||||
totalSize
|
totalSize
|
||||||
edges {
|
edges {
|
||||||
|
@ -70,11 +62,42 @@ query Repo(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
primaryLanguage {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
licenseInfo {
|
||||||
|
name
|
||||||
|
spdxId
|
||||||
|
}
|
||||||
|
diskUsage
|
||||||
|
hasIssuesEnabled
|
||||||
|
issues {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
issuesOpen: issues(states: OPEN) {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
pullRequests {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
pullRequestsOpen: pullRequests(states: OPEN) {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
discussions {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
hasProjectsEnabled
|
||||||
|
projectsUrl
|
||||||
|
projects {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
|
||||||
defaultBranchRef @skip(if: $branchSpecified) {
|
defaultBranchRef @skip(if: $branchSpecified) {
|
||||||
...RepoRef
|
...RefParts
|
||||||
}
|
}
|
||||||
ref(qualifiedName: $branch) @include(if: $branchSpecified) {
|
ref(qualifiedName: $branch) @include(if: $branchSpecified) {
|
||||||
...RepoRef
|
...RefParts
|
||||||
}
|
}
|
||||||
refs(first: 100, refPrefix: "refs/heads/") {
|
refs(first: 100, refPrefix: "refs/heads/") {
|
||||||
totalCount
|
totalCount
|
||||||
|
@ -82,17 +105,8 @@ query Repo(
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
licenseInfo {
|
releases {
|
||||||
name
|
totalCount
|
||||||
spdxId
|
|
||||||
}
|
|
||||||
repositoryTopics(first: 10) {
|
|
||||||
nodes {
|
|
||||||
url
|
|
||||||
topic {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue