feat: apply Charbon·Lime design system, add gear icon, multi-provider git settings
Release APK / build (push) Has been cancelled
Release APK / build (push) Has been cancelled
- Replace app icon with new Charbon·Lime brand assets (icon.png + adaptive-icon.png) - Apply design tokens to theme.ts: bg #1B2433, primary/success #88D656 (lime), text1 #EEF2F5 (cream) - Add ⚙ gear button (lime) in HomeScreen header → navigates to /settings - Expand settings: git provider selector (Gitea / GitHub / GitLab) with per-provider fields - Add lib/git.ts: unified pushIncidentToGit() for Gitea, GitHub (PUT), and GitLab APIs - Update incident detail screen to use lib/git.ts and dynamic provider routing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+53
-18
@@ -12,7 +12,8 @@ import * as Clipboard from "expo-clipboard";
|
||||
import * as SecureStore from "expo-secure-store";
|
||||
import { getIncidentById, updateIncident } from "@/lib/db";
|
||||
import { renderMarkdown } from "@/lib/markdown";
|
||||
import { pushIncidentToGitea } from "@/lib/gitea";
|
||||
import { pushIncidentToGit } from "@/lib/git";
|
||||
import type { GitProvider } from "@/lib/git";
|
||||
import type { Incident } from "@/types/incident";
|
||||
import { Colors } from "@/constants/theme";
|
||||
|
||||
@@ -59,28 +60,62 @@ export default function IncidentDetailScreen() {
|
||||
setIncident({ ...incident, status: "resolved" });
|
||||
}
|
||||
|
||||
async function handleGiteaPush() {
|
||||
async function handleGitPush() {
|
||||
if (!incident) return;
|
||||
const [url, token, owner, repo, template] = await Promise.all([
|
||||
SecureStore.getItemAsync("gitea_url"),
|
||||
SecureStore.getItemAsync("gitea_token"),
|
||||
SecureStore.getItemAsync("gitea_owner"),
|
||||
SecureStore.getItemAsync("gitea_repo"),
|
||||
SecureStore.getItemAsync("md_template"),
|
||||
]);
|
||||
if (!url || !token || !owner || !repo) {
|
||||
Alert.alert("Gitea not configured", "Set up Gitea in Settings first.");
|
||||
const [provider, template, giteaUrl, giteaToken, giteaOwner, giteaRepo, githubToken, githubOwner, githubRepo, gitlabUrl, gitlabToken, gitlabOwner, gitlabRepo] =
|
||||
await Promise.all([
|
||||
SecureStore.getItemAsync("git_provider"),
|
||||
SecureStore.getItemAsync("md_template"),
|
||||
SecureStore.getItemAsync("gitea_url"),
|
||||
SecureStore.getItemAsync("gitea_token"),
|
||||
SecureStore.getItemAsync("gitea_owner"),
|
||||
SecureStore.getItemAsync("gitea_repo"),
|
||||
SecureStore.getItemAsync("github_token"),
|
||||
SecureStore.getItemAsync("github_owner"),
|
||||
SecureStore.getItemAsync("github_repo"),
|
||||
SecureStore.getItemAsync("gitlab_url"),
|
||||
SecureStore.getItemAsync("gitlab_token"),
|
||||
SecureStore.getItemAsync("gitlab_owner"),
|
||||
SecureStore.getItemAsync("gitlab_repo"),
|
||||
]);
|
||||
|
||||
const p = (provider ?? "gitea") as GitProvider;
|
||||
|
||||
let url: string | undefined;
|
||||
let token: string | null;
|
||||
let owner: string | null;
|
||||
let repo: string | null;
|
||||
|
||||
if (p === "gitea") {
|
||||
url = giteaUrl ?? undefined;
|
||||
token = giteaToken;
|
||||
owner = giteaOwner;
|
||||
repo = giteaRepo;
|
||||
} else if (p === "github") {
|
||||
token = githubToken;
|
||||
owner = githubOwner;
|
||||
repo = githubRepo;
|
||||
} else {
|
||||
url = gitlabUrl ?? undefined;
|
||||
token = gitlabToken;
|
||||
owner = gitlabOwner;
|
||||
repo = gitlabRepo;
|
||||
}
|
||||
|
||||
if (!token || !owner || !repo) {
|
||||
Alert.alert("Git not configured", `Set up ${p.charAt(0).toUpperCase() + p.slice(1)} in Settings first.`);
|
||||
return;
|
||||
}
|
||||
|
||||
setPushing(true);
|
||||
const result = await pushIncidentToGitea(
|
||||
const result = await pushIncidentToGit(
|
||||
incident,
|
||||
{ url, token, owner, repo },
|
||||
{ provider: p, url, token, owner, repo },
|
||||
template ?? undefined
|
||||
);
|
||||
setPushing(false);
|
||||
if (result.success) {
|
||||
Alert.alert("Pushed", result.url ? `${result.url}` : "Push successful.");
|
||||
Alert.alert("Pushed", result.url ?? "Push successful.");
|
||||
} else {
|
||||
Alert.alert("Push failed", result.error ?? "Unknown error");
|
||||
}
|
||||
@@ -117,7 +152,7 @@ export default function IncidentDetailScreen() {
|
||||
<View
|
||||
style={{
|
||||
backgroundColor:
|
||||
incident.status === "open" ? "#f59e0b20" : "#22c55e20",
|
||||
incident.status === "open" ? "#f59e0b20" : "#88D65620",
|
||||
borderRadius: 6,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 4,
|
||||
@@ -188,7 +223,7 @@ export default function IncidentDetailScreen() {
|
||||
<Pressable
|
||||
onPress={handleResolve}
|
||||
style={{
|
||||
backgroundColor: "#22c55e20",
|
||||
backgroundColor: "#88D65620",
|
||||
borderWidth: 1,
|
||||
borderColor: Colors.success,
|
||||
borderRadius: 10,
|
||||
@@ -219,7 +254,7 @@ export default function IncidentDetailScreen() {
|
||||
</Pressable>
|
||||
|
||||
<Pressable
|
||||
onPress={handleGiteaPush}
|
||||
onPress={handleGitPush}
|
||||
disabled={pushing}
|
||||
style={{
|
||||
backgroundColor: pushing ? Colors.surface2 : Colors.surface,
|
||||
@@ -237,7 +272,7 @@ export default function IncidentDetailScreen() {
|
||||
fontSize: 15,
|
||||
}}
|
||||
>
|
||||
{pushing ? "Pushing…" : "Push to Gitea"}
|
||||
{pushing ? "Pushing…" : "Push to Git"}
|
||||
</Text>
|
||||
</Pressable>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user